From dbb75806e59aa9cd7f1cd69f548010d78a4c144e Mon Sep 17 00:00:00 2001 From: sjhgithub Date: Sat, 29 Feb 2020 13:35:33 +0800 Subject: [PATCH] bug fix when peer close connection,we must process POLLHUP event --- event/poll.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/event/poll.c b/event/poll.c index 010928a63..ad19a714a 100644 --- a/event/poll.c +++ b/event/poll.c @@ -116,12 +116,19 @@ int iowatcher_poll_events(hloop_t* loop, int timeout) { ++nevents; hio_t* io = loop->ios.ptr[fd]; if (io) { - if (revents & POLLIN) { + //20200227 bugfix by song + //when peer close the connection,pool will capture POLLHUP event,we must process it avoid Infinite looping. + //refrence to https://github.com/RPCS3/rpcs3/blob/master/rpcs3/Emu/Cell/lv2/sys_net.cpp + if (revents & (POLLIN | POLLHUP)) { io->revents |= READ_EVENT; } if (revents & POLLOUT) { io->revents |= WRITE_EVENT; } + if (revents & POLLERR) { + io->revents |= READ_EVENT; + io->revents |= WRITE_EVENT; + } EVENT_PENDING(io); } }