/[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.3 by gray, Wed Apr 30 08:38:30 2003 UTC revision 1.4 by gray, Wed Apr 30 20:12:25 2003 UTC
# Line 25  Line 25 
25    
26  struct input_system {  struct input_system {
27          LIST *methods;    /* List of METHOD structures */          LIST *methods;    /* List of METHOD structures */
28            ITERATOR *mitr;
29          LIST *channels;   /* List of CHANNEL structures */          LIST *channels;   /* List of CHANNEL structures */
30            ITERATOR *citr;
31  };  };
32    
33  typedef struct input_method METHOD;  typedef struct input_method METHOD;
# Line 148  input_close_channels(INPUT *input) Line 150  input_close_channels(INPUT *input)
150  {  {
151          CHANNEL *p;          CHANNEL *p;
152    
153          for (p = list_first(input->channels); p;          if (!input->citr)
154               p = list_next(input->channels)) {                  input->citr = iterator_create(input->channels);
155    
156            for (p = iterator_first(input->citr); p;
157                 p = iterator_next(input->citr)) {
158                    list_remove(input->channels, p, NULL);
159                  channel_close(p);                  channel_close(p);
160                  efree(p);                  efree(p);
                 list_remove_current(input->channels);  
161          }          }
162            iterator_destroy(&input->citr);
163  }  }
164    
165  void  void
# Line 162  input_close_channel_fd(INPUT *input, int Line 168  input_close_channel_fd(INPUT *input, int
168          CHANNEL *p = list_locate(input->channels, &fd, _channel_cmp_fd);          CHANNEL *p = list_locate(input->channels, &fd, _channel_cmp_fd);
169                    
170          if (p) {          if (p) {
171                    list_remove(input->channels, p, NULL);
172                  channel_close(p);                  channel_close(p);
                 list_remove_current(input->channels);  
173          }          }
174  }  }
175    
# Line 189  input_close_channel_data(INPUT *input, c Line 195  input_close_channel_data(INPUT *input, c
195          clos.data = data;          clos.data = data;
196          p = list_locate(input->channels, &clos, _channel_cmp);          p = list_locate(input->channels, &clos, _channel_cmp);
197          if (p) {          if (p) {
198                    list_remove(input->channels, p, NULL);
199                  channel_close(p);                  channel_close(p);
200                  efree(p);                  efree(p);
                 list_remove_current(input->channels);  
201          }          }
202  }  }
203    
# Line 201  input_select(INPUT *input, struct timeva Line 207  input_select(INPUT *input, struct timeva
207          METHOD *m;          METHOD *m;
208          int status;          int status;
209    
210          for (m = list_first(input->methods); m;          if (!input->citr)
211               m = list_next(input->methods)) {                  input->citr = iterator_create(input->channels);
212            if (!input->mitr)
213                    input->mitr = iterator_create(input->methods);
214                    
215            for (m = iterator_first(input->mitr); m;
216                 m = iterator_next(input->mitr)) {
217                  CHANNEL *p;                  CHANNEL *p;
218                  fd_set readfds;                  fd_set readfds;
219    
220                  if (m->fd_max == -2) {                  if (m->fd_max == -2) {
221                          for (p = list_first(input->channels); p;                          for (p = iterator_first(input->citr); p;
222                               p = list_next(input->channels)) {                               p = iterator_next(input->citr)) {
223                                  if (p->method == m && p->fd > m->fd_max)                                  if (p->method == m && p->fd > m->fd_max)
224                                          m->fd_max = p->fd;                                          m->fd_max = p->fd;
225                          }                          }
# Line 227  input_select(INPUT *input, struct timeva Line 238  input_select(INPUT *input, struct timeva
238                          if (errno == EINTR)                          if (errno == EINTR)
239                                  return 0;                                  return 0;
240                  } else if (status > 0) {                  } else if (status > 0) {
241                          for (p = list_first(input->channels); p;                          for (p = iterator_first(input->citr); p;
242                               p = list_next(input->channels)) {                               p = iterator_next(input->citr)) {
243                                  if (FD_ISSET(p->fd, &readfds))                                  if (FD_ISSET(p->fd, &readfds))
244                                          channel_handle(p);                                          channel_handle(p);
245                          }                          }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

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