/[radius]/radius/radiusd/input.c
ViewVC logotype

Diff of /radius/radiusd/input.c

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

revision 1.9 by gray, Sat Jun 7 10:59:37 2003 UTC revision 1.10 by gray, Wed Jun 11 20:46:25 2003 UTC
# Line 256  input_select(INPUT *input, struct timeva Line 256  input_select(INPUT *input, struct timeva
256          return status;          return status;
257  }  }
258    
259    int
260    input_select_channel(INPUT *input, char *name, struct timeval *tv)
261    {
262            CHANNEL *p;
263            int status;
264            fd_set readfds;
265            int fd_max = -1;
266            METHOD *m = list_locate(input->methods, name, _method_comp);
267    
268            debug(100,("enter"));
269            
270            if (!m)
271                    return -1;
272            if (!input->citr)
273                    input->citr = iterator_create(input->channels);
274    
275            FD_ZERO(&readfds);
276            for (p = iterator_first(input->citr); p;
277                 p = iterator_next(input->citr)) {
278                    if (p->method == m) {
279                            if (p->fd > fd_max)
280                                    fd_max = p->fd;
281                            FD_SET(p->fd, &readfds);
282                    }
283            }
284    
285            if (fd_max == -1)
286                    return -1;
287            
288            status = select(fd_max + 1, &readfds, NULL, NULL, tv);
289            
290            if (status == -1) {
291                    if (errno == EINTR)
292                            return 0;
293            } else if (status > 0) {
294                    debug(1, ("select returned %d", status));
295                    
296                    for (p = iterator_first(input->citr); p;
297                         p = iterator_next(input->citr))
298                            if (FD_ISSET(p->fd, &readfds))
299                                    channel_handle(p);
300            }
301            debug(100,("exit"));
302            return status;
303    }
304    
305  struct iterate_closure {  struct iterate_closure {
306          char *name;          char *name;
307          list_iterator_t fun;          list_iterator_t fun;

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26