From f71903d32246ce3967f0270912e16d253396ad62 Mon Sep 17 00:00:00 2001 From: JbLb Date: Fri, 24 Oct 2014 19:21:27 +0200 Subject: [PATCH] Revert "Update network.c" This reverts commit 26fcb932443df9a74871ba9d59d818dbc05a18b6. this permit to compile on older kernel/network sources --- artnet/network.c | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/artnet/network.c b/artnet/network.c index cc25ed3..a975103 100644 --- a/artnet/network.c +++ b/artnet/network.c @@ -508,6 +508,13 @@ int artnet_net_start(node n) { if (n->state.verbose) printf("Binding to %s \n", inet_ntoa(servAddr.sin_addr)); + // bind sockets + if (bind(sock, (SA *) &servAddr, sizeof(servAddr)) == -1) { + artnet_error("Failed to bind to socket %s", artnet_net_last_error()); + artnet_net_close(sock); + return ARTNET_ENET; + } + // allow bcasting if (setsockopt(sock, SOL_SOCKET, @@ -541,30 +548,8 @@ int artnet_net_start(node n) { artnet_net_close(sock); return ARTNET_ENET; } -#else -// allow reusing 6454 port _ - if (setsockopt(sock, - SOL_SOCKET, - SO_REUSEPORT, - (char*) &true_flag, // char* for win32 - sizeof(int)) == -1) { - artnet_error("Failed to bind to socket %s", artnet_net_last_error()); - artnet_net_close(sock); - return ARTNET_ENET; - } #endif - if (n->state.verbose) - printf("Binding to %s \n", inet_ntoa(servAddr.sin_addr)); - - // bind sockets - if (bind(sock, (SA *) &servAddr, sizeof(servAddr)) == -1) { - artnet_error("Failed to bind to socket %s", artnet_net_last_error()); - artnet_net_close(sock); - return ARTNET_ENET; - } - - n->sd = sock; // Propagate the socket to all our peers for (tmp = n->peering.peer; tmp && tmp != n; tmp = tmp->peering.peer)