version 1.257, 2002/07/23 16:03:10 |
version 1.258, 2002/09/13 19:23:09 |
|
|
const char *remote_ip; |
const char *remote_ip; |
int remote_port; |
int remote_port; |
FILE *f; |
FILE *f; |
struct linger linger; |
|
struct addrinfo *ai; |
struct addrinfo *ai; |
char ntop[NI_MAXHOST], strport[NI_MAXSERV]; |
char ntop[NI_MAXHOST], strport[NI_MAXSERV]; |
int listen_sock, maxfd; |
int listen_sock, maxfd; |
|
|
continue; |
continue; |
} |
} |
/* |
/* |
* Set socket options. We try to make the port |
* Set socket options. |
* reusable and have it close as fast as possible |
* Allow local port reuse in TIME_WAIT. |
* without waiting in unnecessary wait states on |
|
* close. |
|
*/ |
*/ |
setsockopt(listen_sock, SOL_SOCKET, SO_REUSEADDR, |
if (setsockopt(listen_sock, SOL_SOCKET, SO_REUSEADDR, |
&on, sizeof(on)); |
&on, sizeof(on)) == -1) |
linger.l_onoff = 1; |
error("setsockopt SO_REUSEADDR: %s", strerror(errno)); |
linger.l_linger = 5; |
|
setsockopt(listen_sock, SOL_SOCKET, SO_LINGER, |
|
&linger, sizeof(linger)); |
|
|
|
debug("Bind to port %s on %s.", strport, ntop); |
debug("Bind to port %s on %s.", strport, ntop); |
|
|
|
|
signal(SIGTERM, SIG_DFL); |
signal(SIGTERM, SIG_DFL); |
signal(SIGQUIT, SIG_DFL); |
signal(SIGQUIT, SIG_DFL); |
signal(SIGCHLD, SIG_DFL); |
signal(SIGCHLD, SIG_DFL); |
|
|
/* |
|
* Set socket options for the connection. We want the socket to |
|
* close as fast as possible without waiting for anything. If the |
|
* connection is not a socket, these will do nothing. |
|
*/ |
|
/* setsockopt(sock_in, SOL_SOCKET, SO_REUSEADDR, (void *)&on, sizeof(on)); */ |
|
linger.l_onoff = 1; |
|
linger.l_linger = 5; |
|
setsockopt(sock_in, SOL_SOCKET, SO_LINGER, &linger, sizeof(linger)); |
|
|
|
/* Set keepalives if requested. */ |
/* Set keepalives if requested. */ |
if (options.keepalives && |
if (options.keepalives && |