Fix setting SO_REUSEADDR

It expects a boolean, not an address
This commit is contained in:
Samuel Thibault 2025-03-16 01:18:52 +01:00
parent b5c198ae87
commit e801ce0c4f

View file

@ -104,7 +104,8 @@ int cluster_init()
addr.sin_family = AF_INET;
addr.sin_port = htons(config->cluster_port);
addr.sin_addr.s_addr = INADDR_ANY;
setsockopt(cluster_sockfd, SOL_SOCKET, SO_REUSEADDR, &addr, sizeof(addr));
opt = 1;
setsockopt(cluster_sockfd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
opt = fcntl(cluster_sockfd, F_GETFL, 0);
fcntl(cluster_sockfd, F_SETFL, opt | O_NONBLOCK);