]> arthur.barton.de Git - netatalk.git/commitdiff
Ensure TCP_NODELAY is set on the AFP session socket
authorFrank Lahm <franklahm@googlemail.com>
Tue, 20 Mar 2012 13:44:19 +0000 (14:44 +0100)
committerFrank Lahm <franklahm@googlemail.com>
Tue, 20 Mar 2012 13:44:19 +0000 (14:44 +0100)
etc/afpd/afp_dsi.c
libatalk/dsi/dsi_tcp.c

index 3105db63efb4fde7831736e11204b83646b8fa48..8379f5bca3706f79997f9b7001275986c1eb407c 100644 (file)
@@ -24,6 +24,7 @@
 #include <sys/stat.h>
 #endif /* HAVE_SYS_STAT_H */
 #include <netinet/in.h>
+#include <netinet/tcp.h>
 #include <arpa/inet.h>
 #include <setjmp.h>
 #include <time.h>
 #include "uid.h"
 #endif /* FORCE_UIDGID */
 
+#ifndef SOL_TCP
+#define SOL_TCP IPPROTO_TCP
+#endif
+
 /* 
  * We generally pass this from afp_over_dsi to all afp_* funcs, so it should already be
  * available everywhere. Unfortunately some funcs (eg acltoownermode) need acces to it
@@ -476,6 +481,10 @@ void afp_over_dsi(AFPObj *obj)
         }
     }
 
+    /* set TCP_NODELAY */
+    int flag = 1;
+    setsockopt(dsi->socket, SOL_TCP, TCP_NODELAY, &flag, sizeof(flag));
+
     /* get stuck here until the end */
     while (1) {
         if (sigsetjmp(recon_jmp, 1) != 0)
index 0c60303ecb6159c5310d44d28f59242876e69e2d..3aa900ff20e5270a4495974d5bb1969298e01275 100644 (file)
@@ -12,8 +12,6 @@
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
 
-#define USE_TCP_NODELAY
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -333,13 +331,11 @@ int dsi_tcp_init(DSI *dsi, const char *hostname, const char *address,
             setsockopt(dsi->serversock, IPPROTO_IPV6, IPV6_BINDV6ONLY, (char *)&on, sizeof (on));
 #endif
 
-#ifdef USE_TCP_NODELAY
 #ifndef SOL_TCP
 #define SOL_TCP IPPROTO_TCP
 #endif
             flag = 1;
             setsockopt(dsi->serversock, SOL_TCP, TCP_NODELAY, &flag, sizeof(flag));
-#endif /* USE_TCP_NODELAY */
             
             if (bind(dsi->serversock, p->ai_addr, p->ai_addrlen) == -1) {
                 close(dsi->serversock);