From 9bce86962ec6d38e210dfadfeedfde328df9cea8 Mon Sep 17 00:00:00 2001 From: Konstantin Osipov <kostja@tarantool.org> Date: Wed, 28 Aug 2013 19:37:21 +0400 Subject: [PATCH] Suppress writing ECONNRESET to the log, this typically happens on client timeout. --- src/sio.cc | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/sio.cc b/src/sio.cc index 03d592df63..a069cd9d75 100644 --- a/src/sio.cc +++ b/src/sio.cc @@ -231,9 +231,27 @@ ssize_t sio_read(int fd, void *buf, size_t count) { ssize_t n = read(fd, buf, count); - if (n < 0 && errno != EAGAIN && - errno != EWOULDBLOCK && errno != EINTR) + if (n < 0) { + if (errno == EWOULDBLOCK) + errno = EINTR; + switch (errno) { + case EAGAIN: + case EINTR: + break; + /* + * Happens typically when the client closes + * socket on timeout without reading the previous + * query's response completely. Treat the same as + * EOF. + */ + case ECONNRESET: + errno = 0; + n = 0; + break; + default: tnt_raise(SocketError, fd, "read(%zd)", count); + } + } return n; } -- GitLab