X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet_socket.c;h=986a7668ef8acfc1712fbb0c6e7bc3452aaca2fe;hb=b99af2f813b897e1fd49c87a7cf44241cad3a017;hp=9bac38aacc148e154dd96a4e57d5ed0e3ac75b78;hpb=e05371346548dee977d4ee45e12e3058e749afb6;p=tinc diff --git a/src/net_socket.c b/src/net_socket.c index 9bac38aa..986a7668 100644 --- a/src/net_socket.c +++ b/src/net_socket.c @@ -473,7 +473,15 @@ static void handle_meta_write(int sock, short events, void *data) { ssize_t outlen = send(c->socket, c->outbuf.data + c->outbuf.offset, c->outbuf.len - c->outbuf.offset, 0); if(outlen <= 0) { - logger(DEBUG_ALWAYS, LOG_ERR, "Onoes, outlen = %d (%s)", (int)outlen, strerror(errno)); + if(!errno || errno == EPIPE) { + logger(DEBUG_CONNECTIONS, LOG_NOTICE, "Connection closed by %s (%s)", c->name, c->hostname); + } else if(sockwouldblock(sockerrno)) { + logger(DEBUG_CONNECTIONS, LOG_DEBUG, "Sending %d bytes to %s (%s) would block", c->outbuf.len - c->outbuf.offset, c->name, c->hostname); + return; + } else { + logger(DEBUG_CONNECTIONS, LOG_ERR, "Could not send %d bytes of data to %s (%s): %s", c->outbuf.len - c->outbuf.offset, c->name, c->hostname, strerror(errno)); + } + terminate_connection(c, c->status.active); return; }