]> git.meshlink.io Git - meshlink/commitdiff
MSG_NOSIGNAL option in send() will prevent SIGPIPE
authorSaverio Proto <zioproto@gmail.com>
Fri, 8 Aug 2014 11:18:42 +0000 (11:18 +0000)
committerSaverio Proto <zioproto@gmail.com>
Fri, 8 Aug 2014 11:21:06 +0000 (13:21 +0200)
src/net_socket.c

index 34eccc9620417532c47cf086b30e16004fa604c7..a99849a76e8a5513629b9c5395454129b863411d 100644 (file)
@@ -305,7 +305,7 @@ static void handle_meta_write(meshlink_handle_t *mesh, connection_t *c) {
        if(c->outbuf.len <= c->outbuf.offset)
                return;
 
-       ssize_t outlen = send(c->socket, c->outbuf.data + c->outbuf.offset, c->outbuf.len - c->outbuf.offset, 0);
+       ssize_t outlen = send(c->socket, c->outbuf.data + c->outbuf.offset, c->outbuf.len - c->outbuf.offset, MSG_NOSIGNAL);
        if(outlen <= 0) {
                if(!errno || errno == EPIPE) {
                        logger(DEBUG_CONNECTIONS, LOG_NOTICE, "Connection closed by %s (%s)", c->name, c->hostname);