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,8 +99,7 @@ TR_commManagerEpollSelect(void * _this, TR_Event event, unsigned long timeout) | ||
99 | int handle = endpoint->transport->handle; | 99 | int handle = endpoint->transport->handle; |
100 | 100 | ||
101 | if ((events[i].events & EPOLLIN) == EPOLLIN) { | 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 | TR_setAdd(cmgr->accept, endpoint); | 103 | TR_setAdd(cmgr->accept, endpoint); |
105 | } else { | 104 | } else { |
106 | if (! event->subject->fin) { | 105 | if (! event->subject->fin) { |
@@ -95,8 +95,7 @@ TR_commManagerPollSelect(void * _this, TR_Event event, unsigned long timeout) | @@ -95,8 +95,7 @@ TR_commManagerPollSelect(void * _this, TR_Event event, unsigned long timeout) | ||
95 | nevents--; | 95 | nevents--; |
96 | 96 | ||
97 | if ((this->fds[i].revents & POLLIN) == POLLIN) { | 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 | TR_setAdd(cmgr->accept, endpoint); | 99 | TR_setAdd(cmgr->accept, endpoint); |
101 | } else { | 100 | } else { |
102 | if (! event->subject->fin) { | 101 | if (! event->subject->fin) { |
@@ -50,8 +50,7 @@ TR_commManagerAddEndpoint(void * _this, TR_CommEndPoint endpoint) | @@ -50,8 +50,7 @@ TR_commManagerAddEndpoint(void * _this, TR_CommEndPoint endpoint) | ||
50 | 50 | ||
51 | this->endpoints[endpoint->transport->handle] = endpoint; | 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 | TR_setAdd(this->accept, endpoint); | 54 | TR_setAdd(this->accept, endpoint); |
56 | TR_ISSUE_IO_ACC_EVENT(this, endpoint); | 55 | TR_ISSUE_IO_ACC_EVENT(this, endpoint); |
57 | } else { | 56 | } else { |
@@ -117,8 +116,7 @@ TR_commManagerPollRead(void * _this, TR_Event event) | @@ -117,8 +116,7 @@ TR_commManagerPollRead(void * _this, TR_Event event) | ||
117 | TR_CommManager this = _this; | 116 | TR_CommManager this = _this; |
118 | TR_CommEndPoint endpoint = (TR_CommEndPoint)event->subject; | 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 | TR_setDelete(this->accept, event->subject); | 120 | TR_setDelete(this->accept, event->subject); |
123 | } else { | 121 | } else { |
124 | TR_setDelete(this->read, event->subject); | 122 | TR_setDelete(this->read, event->subject); |
Please
register
or
login
to post a comment