/[svn]/ircd-hybrid/trunk/src/s_bsd_poll.c
ViewVC logotype

Diff of /ircd-hybrid/trunk/src/s_bsd_poll.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2649 by michael, Fri Dec 6 19:39:55 2013 UTC revision 2650 by michael, Tue Dec 10 19:46:48 2013 UTC
# Line 109  comm_setselect(fde_t *F, unsigned int ty Line 109  comm_setselect(fde_t *F, unsigned int ty
109    }    }
110    
111    new_events = (F->read_handler ? POLLRDNORM : 0) |    new_events = (F->read_handler ? POLLRDNORM : 0) |
112      (F->write_handler ? POLLWRNORM : 0);                 (F->write_handler ? POLLWRNORM : 0);
113    
114    if (timeout != 0)    if (timeout != 0)
115      F->timeout = CurrentTime + (timeout / 1000);      F->timeout = CurrentTime + (timeout / 1000);
# Line 123  comm_setselect(fde_t *F, unsigned int ty Line 123  comm_setselect(fde_t *F, unsigned int ty
123    
124        if (pollmax == F->comm_index)        if (pollmax == F->comm_index)
125          while (pollmax >= 0 && pollfds[pollmax].fd == -1)          while (pollmax >= 0 && pollfds[pollmax].fd == -1)
126            pollmax--;            pollmax--;
127      }      }
128      else      else
129      {      {
130        if (F->evcache == 0)        if (F->evcache == 0)
131        {        {
132          F->comm_index = poll_findslot();          F->comm_index = poll_findslot();
133          if (F->comm_index > pollmax)          if (F->comm_index > pollmax)
134            pollmax = F->comm_index;            pollmax = F->comm_index;
135    
136          pollfds[F->comm_index].fd = F->fd;          pollfds[F->comm_index].fd = F->fd;
137        }        }
138    
139        pollfds[F->comm_index].events = new_events;        pollfds[F->comm_index].events = new_events;
140        pollfds[F->comm_index].revents = 0;        pollfds[F->comm_index].revents = 0;
141      }      }
# Line 182  comm_select(void) Line 183  comm_select(void)
183        continue;        continue;
184    
185      if (revents & (POLLRDNORM | POLLIN | POLLHUP | POLLERR))      if (revents & (POLLRDNORM | POLLIN | POLLHUP | POLLERR))
186        {
187        if ((hdl = F->read_handler) != NULL)        if ((hdl = F->read_handler) != NULL)
188        {        {
189          F->read_handler = NULL;          F->read_handler = NULL;
190          hdl(F, F->read_data);          hdl(F, F->read_data);
191          if (!F->flags.open)          if (!F->flags.open)
192            continue;            continue;
193        }        }
194        }
195    
196      if (revents & (POLLWRNORM | POLLOUT | POLLHUP | POLLERR))      if (revents & (POLLWRNORM | POLLOUT | POLLHUP | POLLERR))
197        {
198        if ((hdl = F->write_handler) != NULL)        if ((hdl = F->write_handler) != NULL)
199        {        {
200          F->write_handler = NULL;          F->write_handler = NULL;
201          hdl(F, F->write_data);          hdl(F, F->write_data);
202          if (!F->flags.open)          if (!F->flags.open)
203            continue;            continue;
204        }        }
205        }
206    
207      comm_setselect(F, 0, NULL, NULL, 0);      comm_setselect(F, 0, NULL, NULL, 0);
208    }    }

Legend:
Removed from v.2649  
changed lines
  Added in v.2650

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28