M #-: Add SO_REUSEADDR to monitord socket

This commit is contained in:
Ruben S. Montero committed 2020-03-13 16:57:12 +01:00
1 parent 6ca44cad75
commit 59e32e3c72
1 file changed
+10
+10
View File
@@ -129,6 +129,16 @@ int TCPStream<E>::action_loop(int threads, std::string& error)
return -1;
}
int on = 1;
rc = setsockopt(_socket, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(int));
if ( rc == -1 )
{
error = strerror(errno);
return -1;
}
rc = bind(_socket, res->ai_addr, res->ai_addrlen);
freeaddrinfo(res);