Add SO_REUSEADDR to the UDP sockets. See if it makes any difference.
This commit is contained in:
@@ -858,6 +858,16 @@ static uint16_t bind_port(int ip_family, const char *self_ip_address, uint32_t s
|
||||
int local_socket = socket(ip_family, SOCK_DGRAM, IPPROTO_UDP);
|
||||
if (local_socket == -1)
|
||||
die("Could not allocate a socket.");
|
||||
|
||||
int val = 1;
|
||||
ret = setsockopt(local_socket, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
|
||||
if (ret < 0) {
|
||||
char errorstring[1024];
|
||||
strerror_r(errno, (char *)errorstring, sizeof(errorstring));
|
||||
debug(1,"Error %d: \"%s\". Couldn't set SO_REUSEADDR");
|
||||
}
|
||||
|
||||
|
||||
SOCKADDR myaddr;
|
||||
int tryCount = 0;
|
||||
uint16_t desired_port;
|
||||
|
||||
Reference in New Issue
Block a user