From 67dfe9946d94663b1bf3a5d809ac189ada91b385 Mon Sep 17 00:00:00 2001 From: miker Date: Wed, 17 Aug 2005 15:43:11 +0000 Subject: [PATCH] add socket options to allow socket recovery and speed up streaming git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@489 9efc2488-bf62-4759-914b-345cdb29e865 --- src/utils/socket_bundle.c | 13 +++++++++++++ src/utils/socket_bundle.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/utils/socket_bundle.c b/src/utils/socket_bundle.c index 7fb556c..8a5b102 100644 --- a/src/utils/socket_bundle.c +++ b/src/utils/socket_bundle.c @@ -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 // ------------------------------------------------------------------ diff --git a/src/utils/socket_bundle.h b/src/utils/socket_bundle.h index 8b9d450..129cf30 100644 --- a/src/utils/socket_bundle.h +++ b/src/utils/socket_bundle.h @@ -19,6 +19,7 @@ #include #include #include +#include #include #include -- 2.11.0