@@ -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)
793792static 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
0 commit comments