From 1e1ec0c133013ea3e3a067031dbc8ff010eeeb42 Mon Sep 17 00:00:00 2001 From: David Nikdel Date: Sat, 16 Jul 2016 20:27:00 -0400 Subject: [PATCH] Update libuv.h - if status is not ok, report that as readable - no need to stop uv_poll_t before changing events according to the docs --- include/libuv.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/include/libuv.h b/include/libuv.h index 612b254..4913199 100644 --- a/include/libuv.h +++ b/include/libuv.h @@ -64,7 +64,7 @@ private: // tell the connection that its filedescriptor is active int fd = -1; uv_fileno(reinterpret_cast(handle), &fd); - connection->process(fd, uv_to_amqp_events(events)); + connection->process(fd, uv_to_amqp_events(status, events)); } public: @@ -119,10 +119,7 @@ private: */ void events(int events) { - // stop the watcher if it was active - uv_poll_stop(_poll); - - // and restart it + // update the events being watched for uv_poll_start(_poll, amqp_to_uv_events(events), callback); } @@ -131,13 +128,15 @@ private: /** * Convert event flags from UV format to AMQP format */ - static int uv_to_amqp_events(int events) + static int uv_to_amqp_events(int status, int events) { 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; }