From 861f2331b86d82c770f38b7a60f8328862fe6da3 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Fri, 6 Nov 2015 13:35:24 +0000 Subject: [PATCH] accept_connection(): Set NO_DELAY flag for the accepting socket This significantly reduces the latency if the operating system is not configured to set the flag by default. For Windows the unnecessary delay has been reported to be ~200ms while on ElectroBSD it's still 100ms. Reported by Johan Sintorn in #894. --- jbsockets.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jbsockets.c b/jbsockets.c index ff1d7a81..7bdb5046 100644 --- a/jbsockets.c +++ b/jbsockets.c @@ -1,4 +1,4 @@ -const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.131 2014/11/14 10:40:24 fabiankeil Exp $"; +const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.132 2015/11/06 13:34:56 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jbsockets.c,v $ @@ -1329,6 +1329,8 @@ int accept_connection(struct client_state * csp, jb_socket fds[]) mark_socket_for_close_on_execute(afd); #endif + set_no_delay_flag(afd); + csp->cfd = afd; #ifdef HAVE_RFC2553 csp->ip_addr_str = malloc_or_die(NI_MAXHOST); -- 2.39.2