Roy Anderson
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
14 additions and
1 deletions
-
src/tunnel.c
|
|
@ -154,10 +154,21 @@ create_and_bind(const char *addr, const char *port) |
|
|
|
} |
|
|
|
|
|
|
|
int opt = 1; |
|
|
|
setsockopt(listen_sock, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)); |
|
|
|
if (fast_open == 1){ |
|
|
|
|
|
|
|
setsockopt(listen_sock, SOL_SOCKET, SO_REUSEADDR, TCP_FASTOPEN, &opt, sizeof(opt)); |
|
|
|
#ifdef SO_NOSIGPIPE |
|
|
|
setsockopt(listen_sock, SOL_SOCKET, SO_NOSIGPIPE, TCP_FASTOPEN, &opt, sizeof(opt)); |
|
|
|
#endif |
|
|
|
} |
|
|
|
else { |
|
|
|
setsockopt(listen_sock, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)); |
|
|
|
#ifdef SO_NOSIGPIPE |
|
|
|
setsockopt(listen_sock, SOL_SOCKET, SO_NOSIGPIPE, &opt, sizeof(opt)); |
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (reuse_port) { |
|
|
|
int err = set_reuseport(listen_sock); |
|
|
|
if (err == 0) { |
|
|
@ -1022,6 +1033,8 @@ main(int argc, char **argv) |
|
|
|
if (reuse_port == 0) { |
|
|
|
reuse_port = conf->reuse_port; |
|
|
|
} |
|
|
|
fast_open = conf->fast_open; |
|
|
|
|
|
|
|
#ifdef HAVE_SETRLIMIT |
|
|
|
if (nofile == 0) { |
|
|
|
nofile = conf->nofile; |
|
|
|