accept_connection(): Set NO_DELAY flag for the accepting socket
authorFabian Keil <fk@fabiankeil.de>
Fri, 6 Nov 2015 13:35:24 +0000 (13:35 +0000)
committerFabian Keil <fk@fabiankeil.de>
Fri, 6 Nov 2015 13:35:24 +0000 (13:35 +0000)
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

index ff1d7a8..7bdb504 100644 (file)
@@ -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);