- IOCHAN p, *nextp;
- fd_set in, out, except;
- int res, max;
- static struct timeval nullto = {0, 0}, to;
- struct timeval *timeout;
-
- FD_ZERO(&in);
- FD_ZERO(&out);
- FD_ZERO(&except);
- timeout = &to; /* hang on select */
- to.tv_sec = 300;
- to.tv_usec = 0;
- max = 0;
- for (p = *iochans; p; p = p->next)
- {
+ IOCHAN p, *nextp;
+ IOCHAN start;
+ IOCHAN inv_start;
+ fd_set in, out, except;
+ int res, max;
+ static struct timeval to;
+ struct timeval *timeout;
+
+// struct yaz_poll_fd *fds;
+ int no_fds = 0;
+ FD_ZERO(&in);
+ FD_ZERO(&out);
+ FD_ZERO(&except);
+ timeout = &to; /* hang on select */
+ to.tv_sec = 300;
+ to.tv_usec = 0;
+
+ // INV: start must no change through the loop
+
+ yaz_mutex_enter(man->iochan_mutex);
+ start = man->channel_list;
+ yaz_mutex_leave(man->iochan_mutex);
+ inv_start = start;
+ for (p = start; p; p = p->next) {
+ no_fds++;
+ }
+// fds = (struct yaz_poll_fd *) xmalloc(no_fds * sizeof(*fds));
+
+ max = 0;
+ for (p = start; p; p = p->next) {