+static IOCHAN iochan_man_get_first(struct iochan_man_iter *iter, iochan_man_t man) {
+ iter->man = man;
+ iter->first = 1;
+ yaz_mutex_enter(man->iochan_mutex);
+ iter->current = man->channel_list;
+ yaz_log(man->log_level, "iochan_man_get_first : chan=%p ", iter->current);
+ if (!iter->current)
+ yaz_mutex_leave(man->iochan_mutex);
+ return iter->current;
+}
+
+static IOCHAN iochan_man_get_next(struct iochan_man_iter *iter) {
+ IOCHAN current = NULL, next = NULL;
+ current = iter->current;
+ assert(current);
+ if (current) {
+ next = current->next;
+ iter->current = iter->current->next;
+ if (iter->first) {
+ yaz_log(iter->man->log_level, "iochan_man_get_next : chan=%p next=%p", current, next);
+ iter->first = 0;
+ yaz_mutex_leave(iter->man->iochan_mutex);
+ }
+ }
+ return iter->current;
+}
+