summaryrefslogtreecommitdiffstats
path: root/src/zabbix_agent
diff options
context:
space:
mode:
Diffstat (limited to 'src/zabbix_agent')
-rw-r--r--src/zabbix_agent/zabbix_agentd.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/zabbix_agent/zabbix_agentd.c b/src/zabbix_agent/zabbix_agentd.c
index ecf8d24d..430864e6 100644
--- a/src/zabbix_agent/zabbix_agentd.c
+++ b/src/zabbix_agent/zabbix_agentd.c
@@ -400,6 +400,7 @@ int tcp_listen(const char *host, int port, socklen_t *addrlenp)
{
int sockfd;
struct sockaddr_in serv_addr;
+ int on;
/* struct linger ling;*/
@@ -409,6 +410,15 @@ int tcp_listen(const char *host, int port, socklen_t *addrlenp)
exit(1);
}
+ /* Enable address reuse */
+ /* This is to immediately use the address even if it is in TIME_WAIT state */
+ /* http://www-128.ibm.com/developerworks/linux/library/l-sockpit/index.html */
+ on = 1;
+ if( -1 == setsockopt( sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on) ))
+ {
+ zabbix_log(LOG_LEVEL_WARNING, "Cannot setsockopt SO_REUSEADDR [%s]", strerror(errno));
+ }
+
/*
if(CONFIG_NOTIMEWAIT == 1)
{