add socket options to allow socket recovery and speed up streaming
authormiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Wed, 17 Aug 2005 15:43:11 +0000 (15:43 +0000)
committermiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Wed, 17 Aug 2005 15:43:11 +0000 (15:43 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@489 9efc2488-bf62-4759-914b-345cdb29e865

src/utils/socket_bundle.c
src/utils/socket_bundle.h

index 7fb556c..8a5b102 100644 (file)
@@ -138,6 +138,14 @@ int socket_open_unix_server(socket_manager* mgr, char* path) {
                return warning_handler("socket_open_unix_server(): listen() returned error");
 
        debug_handler("unix socket successfully opened");
+       
+       int i = 1;
+       debug_handler("Setting SO_REUSEADDR");
+       setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, &i, sizeof(i));
+       
+       debug_handler("Setting TCP_NODELAY");
+       setsockopt(sock_fd, IPPROTO_TCP, TCP_NODELAY, &i, sizeof(i));
+
        _socket_add_node(mgr, SERVER_SOCKET, UNIX, sock_fd, 0);
        return sock_fd;
 }
@@ -157,6 +165,11 @@ int socket_open_tcp_client(socket_manager* mgr, int port, char* dest_addr) {
       return -1;
    }
 
+       int i = 1;
+       debug_handler("Setting TCP_NODELAY");
+       setsockopt(sock_fd, IPPROTO_TCP, TCP_NODELAY, &i, sizeof(i));
+
+
    // ------------------------------------------------------------------
    // Get the hostname
    // ------------------------------------------------------------------
index 8b9d450..129cf30 100644 (file)
@@ -19,6 +19,7 @@
 #include <arpa/inet.h>
 #include <netdb.h>
 #include <netinet/in.h>
+#include <netinet/tcp.h>
 #include <sys/un.h>
 
 #include <signal.h>