map closed sockets to both read and write

- this is more consistent with libev so probably will match what existing code expects
This commit is contained in:
David Nikdel 2016-07-16 20:43:19 -04:00 committed by GitHub
parent 584d92e751
commit fd69a4c01d
1 changed files with 5 additions and 2 deletions

View File

@ -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;
}