diff --git a/deps/evcom/evcom.c b/deps/evcom/evcom.c index 40e80de6ef..4267d351e8 100644 --- a/deps/evcom/evcom.c +++ b/deps/evcom/evcom.c @@ -605,16 +605,20 @@ stream_send__data (evcom_stream *stream) } if (sent <= 0) { - if (errno == EAGAIN || errno == EINTR) { - assert(stream->send_action == stream_send__data); - return AGAIN; - } - - stream->errorno = errno; - evcom_perror("send()", errno); + switch (errno) { + case EAGAIN: + case EINTR: + assert(stream->send_action == stream_send__data); + return AGAIN; - stream->send_action = stream_send__close; - return OKAY; + default: + stream->errorno = errno; + evcom_perror("send()", errno); + /* pass through */ + case EPIPE: + stream->send_action = stream_send__close; + return OKAY; + } } ev_timer_again(D_LOOP_(stream) &stream->timeout_watcher); @@ -1151,6 +1155,9 @@ evcom_stream_write (evcom_stream *stream, const char *str, size_t len) if (sent < 0) { switch (errno) { + case EPIPE: + goto close; + case EINTR: case EAGAIN: sent = 0;