Skip to content

Commit

Permalink
Merge pull request OpenLightingProject#5 from sl1200mk2/master
Browse files Browse the repository at this point in the history
Update network.c
  • Loading branch information
nomis52 committed Apr 22, 2014
2 parents 713efee + 26fcb93 commit f899b7b
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions artnet/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,13 +508,6 @@ 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,
Expand Down Expand Up @@ -548,8 +541,30 @@ 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)
Expand Down

0 comments on commit f899b7b

Please sign in to comment.