diff options
Diffstat (limited to 'toxcore/network.c')
-rw-r--r-- | toxcore/network.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/toxcore/network.c b/toxcore/network.c index 47afab8e..7813ab03 100644 --- a/toxcore/network.c +++ b/toxcore/network.c | |||
@@ -150,6 +150,21 @@ int set_socket_nonblock(sock_t sock) | |||
150 | #endif | 150 | #endif |
151 | } | 151 | } |
152 | 152 | ||
153 | /* Set socket to not emit SIGPIPE | ||
154 | * | ||
155 | * return 1 on success | ||
156 | * return 0 on failure | ||
157 | */ | ||
158 | int set_socket_nosigpipe(sock_t sock) | ||
159 | { | ||
160 | #if defined(__MACH__) | ||
161 | int set = 1; | ||
162 | return (setsockopt(sock, SOL_SOCKET, SO_NOSIGPIPE, (void *)&set, sizeof(int)) == 0); | ||
163 | #else | ||
164 | return 1; | ||
165 | #endif | ||
166 | } | ||
167 | |||
153 | /* Set socket to dual (IPv4 + IPv6 socket) | 168 | /* Set socket to dual (IPv4 + IPv6 socket) |
154 | * | 169 | * |
155 | * return 1 on success | 170 | * return 1 on success |