mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 07:18:30 +00:00
Make a few fixups
This commit is contained in:
parent
a5849f8549
commit
6070a53e89
8 changed files with 176 additions and 88 deletions
|
@ -213,13 +213,7 @@ void StartTcpServer(void) {
|
|||
|
||||
LOGIFNEG1(setsockopt(g_servfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)));
|
||||
if (bind(g_servfd, &g_servaddr, sizeof(g_servaddr)) == -1) {
|
||||
if (g_servaddr.sin_port != 0) {
|
||||
g_servaddr.sin_port = 0;
|
||||
StartTcpServer();
|
||||
return;
|
||||
} else {
|
||||
FATALF("bind failed %m");
|
||||
}
|
||||
FATALF("bind failed %m");
|
||||
}
|
||||
CHECK_NE(-1, listen(g_servfd, 10));
|
||||
asize = sizeof(g_servaddr);
|
||||
|
@ -507,7 +501,7 @@ int Poll(void) {
|
|||
TryAgain:
|
||||
if (g_interrupted) return 0;
|
||||
fds[0].fd = g_servfd;
|
||||
fds[0].events = POLLIN;
|
||||
fds[0].events = POLLIN | POLLERR | POLLHUP;
|
||||
wait = MIN(1000, g_timeout);
|
||||
evcount = poll(fds, ARRAYLEN(fds), wait);
|
||||
if (!evcount) g_timeout -= wait;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue