[rrd-developers] [PATCH] set SO_REUSEADDR on the listen socket

kevin brintnall kbrint at rufus.net
Thu Sep 25 19:50:35 CEST 2008


---
 src/rrd_daemon.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/rrd_daemon.c b/src/rrd_daemon.c
index 6f01f89..436d0a0 100644
--- a/src/rrd_daemon.c
+++ b/src/rrd_daemon.c
@@ -1605,6 +1605,7 @@ static int open_listen_socket (const char *addr) /* {{{ */
   {
     int fd;
     listen_socket_t *temp;
+    int one = 1;
 
     temp = (listen_socket_t *) realloc (listen_fds,
         sizeof (listen_fds[0]) * (listen_fds_num + 1));
@@ -1623,6 +1624,8 @@ static int open_listen_socket (const char *addr) /* {{{ */
       continue;
     }
 
+    setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
+
     status = bind (fd, ai_ptr->ai_addr, ai_ptr->ai_addrlen);
     if (status != 0)
     {
-- 
1.6.0.2



More information about the rrd-developers mailing list