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);
assert(pthread_mutexattr_init(&attr) == 0);
assert(pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) == 0);
assert(pthread_mutex_init(&mesh->mutex, &attr) == 0);
+ assert(pthread_cond_init(&mesh->cond, NULL) == 0);
assert(pthread_mutex_init(&mesh->discovery_mutex, NULL) == 0);
assert(pthread_cond_init(&mesh->discovery_cond, NULL) == 0);
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)) {