X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fmeshlink.c;fp=src%2Fmeshlink.c;h=a5d8d43121b025cf1c7b5993c93b4f464d31e675;hb=8635449a060aae62af80dad139dc06fbb9a346d9;hp=d3cf36ad5e5801fdaae0d8591520841cea230385;hpb=6b125b5b68e2657eae9b36f23d7f569fb9e49f8d;p=meshlink diff --git a/src/meshlink.c b/src/meshlink.c index d3cf36ad..a5d8d431 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -268,6 +268,11 @@ char *meshlink_get_external_address_for_family(meshlink_handle_t *mesh, int fami int s = socket_in_netns(aip->ai_family, aip->ai_socktype, aip->ai_protocol, mesh->netns); +#ifdef SO_NOSIGPIPE + int nosigpipe = 1; + setsockopt(s, SOL_SOCKET, SO_NOSIGPIPE, &nosigpipe, sizeof(nosigpipe)); +#endif + if(s >= 0) { set_timeout(s, 5000); @@ -2905,6 +2910,11 @@ bool meshlink_join(meshlink_handle_t *mesh, const char *invitation) { continue; } +#ifdef SO_NOSIGPIPE + int nosigpipe = 1; + setsockopt(state.sock, SOL_SOCKET, SO_NOSIGPIPE, &nosigpipe, sizeof(nosigpipe)); +#endif + set_timeout(state.sock, 5000); if(connect(state.sock, aip->ai_addr, aip->ai_addrlen)) {