diff options
author | Mattias Andrée <maandree@kth.se> | 2016-08-06 03:07:11 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2016-08-06 03:07:11 +0200 |
commit | 4fc199ac4095bbe0de4f28d8f67f327f2e15f851 (patch) | |
tree | cdef03016d6d55be288fe8160be09f35ec56005c | |
parent | Add debug output (socket communication) if -DDEBUG_MODE is used (diff) | |
download | libcoopgamma-4fc199ac4095bbe0de4f28d8f67f327f2e15f851.tar.gz libcoopgamma-4fc199ac4095bbe0de4f28d8f67f327f2e15f851.tar.bz2 libcoopgamma-4fc199ac4095bbe0de4f28d8f67f327f2e15f851.tar.xz |
Use MSG_NOSIGNAL when sending
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r-- | src/libcoopgamma.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libcoopgamma.c b/src/libcoopgamma.c index b72e856..2a9879b 100644 --- a/src/libcoopgamma.c +++ b/src/libcoopgamma.c @@ -1475,9 +1475,11 @@ int libcoopgamma_flush(libcoopgamma_context_t* restrict ctx) { sendsize = ctx->outbound_head - ctx->outbound_tail; sendsize = sendsize < chunksize ? sendsize : chunksize; - sent = send(ctx->fd, ctx->outbound + ctx->outbound_tail, sendsize, 0); + sent = send(ctx->fd, ctx->outbound + ctx->outbound_tail, sendsize, MSG_NOSIGNAL); if (sent < 0) { + if (errno == EPIPE) + errno = ECONNRESET; if (errno != EMSGSIZE) return -1; if ((chunksize >>= 1) == 0) |