From fd69a4c01dec0463b222fada31d3367d03fe6356 Mon Sep 17 00:00:00 2001 From: David Nikdel Date: Sat, 16 Jul 2016 20:43:19 -0400 Subject: [PATCH] map closed sockets to both read and write - this is more consistent with libev so probably will match what existing code expects --- include/libuv.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/libuv.h b/include/libuv.h index 8649407..d48303f 100644 --- a/include/libuv.h +++ b/include/libuv.h @@ -130,13 +130,16 @@ private: */ static int uv_to_amqp_events(int status, int events) { + // if the socket is closed report both so we pick up the error + if (status != 0) + return AMQP::readable | AMQP::writable; + + // map read or write int amqp_events = 0; if (events & UV_READABLE) amqp_events |= AMQP::readable; if (events & UV_WRITABLE) amqp_events |= AMQP::writable; - if (status != 0) - amqp_events |= AMQP::readable; return amqp_events; }