summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/socketengine_ports.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/socketengine_ports.cpp b/src/socketengine_ports.cpp
index f036a8e10..18c931748 100644
--- a/src/socketengine_ports.cpp
+++ b/src/socketengine_ports.cpp
@@ -106,7 +106,12 @@ int PortsEngine::DispatchEvents()
{
case PORT_SOURCE_FD:
int fd = this->events[i].portev_object;
- ref[fd]->HandleEvent((this->events[i].portev_events & POLLRDNORM) ? EVENT_READ : EVENT_WRITE);
+ if (ref[fd])
+ {
+ // reinsert port for next time around
+ port_associate(EngineHandle, PORT_SOURCE_FD, fd, POLLRDNORM, ref[fd]);
+ ref[fd]->HandleEvent((this->events[i].portev_events & POLLRDNORM) ? EVENT_READ : EVENT_WRITE);
+ }
default:
break;
}