Skip to content

Commit 1268016

Browse files
committed
remove tcp_nodelay
1 parent 2a879bc commit 1268016

File tree

4 files changed

+5
-17
lines changed

4 files changed

+5
-17
lines changed

src/local.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ int create_and_bind(const char *addr, const char *port)
154154

155155
int opt = 1;
156156
setsockopt(listen_sock, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
157-
setsockopt(listen_sock, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt));
158157
#ifdef SO_NOSIGPIPE
159158
setsockopt(listen_sock, SOL_SOCKET, SO_NOSIGPIPE, &opt, sizeof(opt));
160159
#endif
@@ -793,7 +792,6 @@ static void close_and_free_server(EV_P_ struct server *server)
793792
static struct remote * connect_to_remote(struct listen_ctx *listener,
794793
const char *host, const char *port)
795794
{
796-
int opt = 1;
797795
int sockfd;
798796
struct addrinfo *remote_res;
799797

@@ -829,8 +827,8 @@ static struct remote * connect_to_remote(struct listen_ctx *listener,
829827
return NULL;
830828
}
831829

832-
setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt));
833830
#ifdef SO_NOSIGPIPE
831+
int opt = 1;
834832
setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &opt, sizeof(opt));
835833
#endif
836834

@@ -868,9 +866,8 @@ void accept_cb(EV_P_ ev_io *w, int revents)
868866
return;
869867
}
870868
setnonblocking(serverfd);
871-
int opt = 1;
872-
setsockopt(serverfd, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt));
873869
#ifdef SO_NOSIGPIPE
870+
int opt = 1;
874871
setsockopt(serverfd, SOL_SOCKET, SO_NOSIGPIPE, &opt, sizeof(opt));
875872
#endif
876873

src/redir.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ int create_and_bind(const char *addr, const char *port)
127127

128128
int opt = 1;
129129
setsockopt(listen_sock, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
130-
setsockopt(listen_sock, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt));
131130
#ifdef SO_NOSIGPIPE
132131
setsockopt(listen_sock, SOL_SOCKET, SO_NOSIGPIPE, &opt, sizeof(opt));
133132
#endif
@@ -589,7 +588,6 @@ static void accept_cb(EV_P_ ev_io *w, int revents)
589588

590589
setnonblocking(clientfd);
591590
int opt = 1;
592-
setsockopt(clientfd, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt));
593591
#ifdef SO_NOSIGPIPE
594592
setsockopt(clientfd, SOL_SOCKET, SO_NOSIGPIPE, &opt, sizeof(opt));
595593
#endif
@@ -615,7 +613,6 @@ static void accept_cb(EV_P_ ev_io *w, int revents)
615613
return;
616614
}
617615

618-
setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt));
619616
#ifdef SO_NOSIGPIPE
620617
setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &opt, sizeof(opt));
621618
#endif

src/server.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ int create_and_bind(const char *host, const char *port)
154154

155155
int opt = 1;
156156
setsockopt(listen_sock, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
157-
setsockopt(listen_sock, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt));
158157
#ifdef SO_NOSIGPIPE
159158
setsockopt(listen_sock, SOL_SOCKET, SO_NOSIGPIPE, &opt, sizeof(opt));
160159
#endif
@@ -198,7 +197,6 @@ static struct remote *connect_to_remote(struct addrinfo *res,
198197
struct server *server)
199198
{
200199
int sockfd;
201-
int opt = 1;
202200
#ifdef SET_INTERFACE
203201
const char *iface = server->listen_ctx->iface;
204202
#endif
@@ -211,8 +209,8 @@ static struct remote *connect_to_remote(struct addrinfo *res,
211209
return NULL;
212210
}
213211

214-
setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt));
215212
#ifdef SO_NOSIGPIPE
213+
int opt = 1;
216214
setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &opt, sizeof(opt));
217215
#endif
218216

@@ -889,9 +887,8 @@ static void accept_cb(EV_P_ ev_io *w, int revents)
889887
}
890888
setnonblocking(serverfd);
891889

892-
int opt = 1;
893-
setsockopt(serverfd, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt));
894890
#ifdef SO_NOSIGPIPE
891+
int opt = 1;
895892
setsockopt(serverfd, SOL_SOCKET, SO_NOSIGPIPE, &opt, sizeof(opt));
896893
#endif
897894

src/tunnel.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ int create_and_bind(const char *addr, const char *port)
131131

132132
int opt = 1;
133133
setsockopt(listen_sock, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
134-
setsockopt(listen_sock, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt));
135134
#ifdef SO_NOSIGPIPE
136135
setsockopt(listen_sock, SOL_SOCKET, SO_NOSIGPIPE, &opt, sizeof(opt));
137136
#endif
@@ -573,9 +572,8 @@ static void accept_cb(EV_P_ ev_io *w, int revents)
573572
return;
574573
}
575574
setnonblocking(serverfd);
576-
int opt = 1;
577-
setsockopt(serverfd, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt));
578575
#ifdef SO_NOSIGPIPE
576+
int opt = 1;
579577
setsockopt(serverfd, SOL_SOCKET, SO_NOSIGPIPE, &opt, sizeof(opt));
580578
#endif
581579

@@ -603,7 +601,6 @@ static void accept_cb(EV_P_ ev_io *w, int revents)
603601
return;
604602
}
605603

606-
setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt));
607604
#ifdef SO_NOSIGPIPE
608605
setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &opt, sizeof(opt));
609606
#endif

0 commit comments

Comments
 (0)