Commit 7360a155a72ce26b5c175f1137d1ffb867cac524
1 parent
3909f6c4
Use new flag that indicates a socket as a filedescriptor getter.
Showing
3 changed files
with
4 additions
and
8 deletions
| ... | ... | @@ -99,8 +99,7 @@ TR_commManagerEpollSelect(void * _this, TR_Event event, unsigned long timeout) |
| 99 | 99 | int handle = endpoint->transport->handle; |
| 100 | 100 | |
| 101 | 101 | if ((events[i].events & EPOLLIN) == EPOLLIN) { |
| 102 | - if (TR_INSTANCE_OF(TR_TcpSocket, endpoint->transport) | |
| 103 | - && ((TR_TcpSocket)endpoint->transport)->listen) { | |
| 102 | + if (TR_socketFdGetter(endpoint->transport)) { | |
| 104 | 103 | TR_setAdd(cmgr->accept, endpoint); |
| 105 | 104 | } else { |
| 106 | 105 | if (! event->subject->fin) { | ... | ... |
| ... | ... | @@ -95,8 +95,7 @@ TR_commManagerPollSelect(void * _this, TR_Event event, unsigned long timeout) |
| 95 | 95 | nevents--; |
| 96 | 96 | |
| 97 | 97 | if ((this->fds[i].revents & POLLIN) == POLLIN) { |
| 98 | - if (TR_INSTANCE_OF(TR_TcpSocket, endpoint->transport) | |
| 99 | - && ((TR_TcpSocket)endpoint->transport)->listen) { | |
| 98 | + if (TR_socketFdGetter(endpoint->transport)) { | |
| 100 | 99 | TR_setAdd(cmgr->accept, endpoint); |
| 101 | 100 | } else { |
| 102 | 101 | if (! event->subject->fin) { | ... | ... |
| ... | ... | @@ -50,8 +50,7 @@ TR_commManagerAddEndpoint(void * _this, TR_CommEndPoint endpoint) |
| 50 | 50 | |
| 51 | 51 | this->endpoints[endpoint->transport->handle] = endpoint; |
| 52 | 52 | |
| 53 | - if (TR_INSTANCE_OF(TR_TcpSocket, endpoint->transport) | |
| 54 | - && ((TR_TcpSocket)endpoint->transport)->listen) { | |
| 53 | + if (TR_socketFdGetter(endpoint->transport)) { | |
| 55 | 54 | TR_setAdd(this->accept, endpoint); |
| 56 | 55 | TR_ISSUE_IO_ACC_EVENT(this, endpoint); |
| 57 | 56 | } else { |
| ... | ... | @@ -117,8 +116,7 @@ TR_commManagerPollRead(void * _this, TR_Event event) |
| 117 | 116 | TR_CommManager this = _this; |
| 118 | 117 | TR_CommEndPoint endpoint = (TR_CommEndPoint)event->subject; |
| 119 | 118 | |
| 120 | - if (TR_INSTANCE_OF(TR_TcpSocket, endpoint->transport) | |
| 121 | - && ((TR_TcpSocket)endpoint->transport)->listen) { | |
| 119 | + if (TR_socketFdGetter(endpoint->transport)) { | |
| 122 | 120 | TR_setDelete(this->accept, event->subject); |
| 123 | 121 | } else { |
| 124 | 122 | TR_setDelete(this->read, event->subject); | ... | ... |
Please
register
or
login
to post a comment