109 |
|
} |
110 |
|
|
111 |
|
new_events = (F->read_handler ? POLLRDNORM : 0) | |
112 |
< |
(F->write_handler ? POLLWRNORM : 0); |
112 |
> |
(F->write_handler ? POLLWRNORM : 0); |
113 |
|
|
114 |
|
if (timeout != 0) |
115 |
|
F->timeout = CurrentTime + (timeout / 1000); |
123 |
|
|
124 |
|
if (pollmax == F->comm_index) |
125 |
|
while (pollmax >= 0 && pollfds[pollmax].fd == -1) |
126 |
< |
pollmax--; |
126 |
> |
pollmax--; |
127 |
|
} |
128 |
|
else |
129 |
|
{ |
130 |
|
if (F->evcache == 0) |
131 |
|
{ |
132 |
|
F->comm_index = poll_findslot(); |
133 |
< |
if (F->comm_index > pollmax) |
134 |
< |
pollmax = F->comm_index; |
133 |
> |
if (F->comm_index > pollmax) |
134 |
> |
pollmax = F->comm_index; |
135 |
|
|
136 |
< |
pollfds[F->comm_index].fd = F->fd; |
136 |
> |
pollfds[F->comm_index].fd = F->fd; |
137 |
|
} |
138 |
+ |
|
139 |
|
pollfds[F->comm_index].events = new_events; |
140 |
|
pollfds[F->comm_index].revents = 0; |
141 |
|
} |
183 |
|
continue; |
184 |
|
|
185 |
|
if (revents & (POLLRDNORM | POLLIN | POLLHUP | POLLERR)) |
186 |
+ |
{ |
187 |
|
if ((hdl = F->read_handler) != NULL) |
188 |
|
{ |
189 |
|
F->read_handler = NULL; |
190 |
|
hdl(F, F->read_data); |
191 |
< |
if (!F->flags.open) |
192 |
< |
continue; |
191 |
> |
if (!F->flags.open) |
192 |
> |
continue; |
193 |
|
} |
194 |
+ |
} |
195 |
|
|
196 |
|
if (revents & (POLLWRNORM | POLLOUT | POLLHUP | POLLERR)) |
197 |
+ |
{ |
198 |
|
if ((hdl = F->write_handler) != NULL) |
199 |
|
{ |
200 |
|
F->write_handler = NULL; |
201 |
|
hdl(F, F->write_data); |
202 |
< |
if (!F->flags.open) |
203 |
< |
continue; |
202 |
> |
if (!F->flags.open) |
203 |
> |
continue; |
204 |
|
} |
205 |
+ |
} |
206 |
|
|
207 |
|
comm_setselect(F, 0, NULL, NULL, 0); |
208 |
|
} |