|
|
|
@ -82,37 +82,39 @@ TR_commManagerPollSelect(void * _this, TR_Event event, int timeout) |
|
|
|
|
|
|
|
nevents = poll(this->fds, cmgr->n_endpoints, timeout); |
|
|
|
|
|
|
|
for (i = 0; i < cmgr->n_endpoints; i++) { |
|
|
|
TR_CommEndPoint endpoint = cmgr->endpoints[i]; |
|
|
|
if (nevents) { |
|
|
|
for (i = 0; i < cmgr->n_endpoints; i++) { |
|
|
|
TR_CommEndPoint endpoint = cmgr->endpoints[i]; |
|
|
|
|
|
|
|
if ((this->fds[i].revents & POLLIN) == POLLIN) { |
|
|
|
nevents--; |
|
|
|
if (TR_INSTANCE_OF(TR_TcpSocket, endpoint->transport) |
|
|
|
&& ((TR_TcpSocket)endpoint->transport)->listen) { |
|
|
|
TR_eventHandlerIssueEvent( |
|
|
|
(TR_EventHandler)this, |
|
|
|
(TR_EventSubject)endpoint, |
|
|
|
TR_CET_EVENT_ACC_READY, |
|
|
|
NULL); |
|
|
|
} else { |
|
|
|
TR_eventHandlerIssueEvent( |
|
|
|
(TR_EventHandler)this, |
|
|
|
(TR_EventSubject)endpoint, |
|
|
|
TR_CEP_EVENT_READ_READY, |
|
|
|
NULL); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if ((this->fds[i].revents & POLLIN) == POLLIN) { |
|
|
|
nevents--; |
|
|
|
if (TR_INSTANCE_OF(TR_TcpSocket, endpoint->transport) |
|
|
|
&& ((TR_TcpSocket)endpoint->transport)->listen) { |
|
|
|
TR_eventHandlerIssueEvent( |
|
|
|
(TR_EventHandler)this, |
|
|
|
(TR_EventSubject)endpoint, |
|
|
|
TR_CET_EVENT_ACC_READY, |
|
|
|
NULL); |
|
|
|
} else { |
|
|
|
if ((this->fds[i].revents & POLLOUT) == POLLOUT) { |
|
|
|
nevents--; |
|
|
|
TR_eventHandlerIssueEvent( |
|
|
|
(TR_EventHandler)this, |
|
|
|
(TR_EventSubject)endpoint, |
|
|
|
TR_CEP_EVENT_READ_READY, |
|
|
|
TR_CEP_EVENT_WRITE_READY, |
|
|
|
NULL); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if ((this->fds[i].revents & POLLOUT) == POLLOUT) { |
|
|
|
nevents--; |
|
|
|
TR_eventHandlerIssueEvent( |
|
|
|
(TR_EventHandler)this, |
|
|
|
(TR_EventSubject)endpoint, |
|
|
|
TR_CEP_EVENT_WRITE_READY, |
|
|
|
NULL); |
|
|
|
if (nevents <= 0) break; |
|
|
|
} |
|
|
|
|
|
|
|
if (nevents <= 0) break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|