man->sel_thread = 0; /* can't create sel_thread yet because we may fork */
man->sel_fd = -1;
man->no_threads = no_threads;
- man->log_level = YLOG_DEBUG;
+ man->log_level = yaz_log_module_level("iochan");
+
return man;
}
new_iochan->fun = cb;
new_iochan->socketfun = NULL;
new_iochan->maskfun = NULL;
- new_iochan->force_event = 0;
new_iochan->last_event = new_iochan->max_idle = 0;
new_iochan->next = NULL;
new_iochan->man = 0;
{
if (man->sel_thread)
{
- yaz_log(man->log_level, "eventl: add fun chan=%p name=%s event=%d",
+ yaz_log(man->log_level, "eventl: work add chan=%p name=%s event=%d",
p, p->name ? p->name : "", p->this_event);
p->thread_users++;
sel_thread_add(man->sel_thread, p);
to.tv_sec = p->max_idle;
if (p->fd < 0)
continue;
- if (p->force_event)
- timeout = &nullto; /* polling select */
if (p->flags & EVENT_INPUT)
FD_SET(p->fd, &in);
if (p->flags & EVENT_OUTPUT)
}
}
}
+ if (man->log_level)
+ {
+ int no = 0;
+ for (p = *iochans; p; p = p->next)
+ no++;
+ yaz_log(man->log_level, "%d channels", no);
+ }
for (p = *iochans; p; p = p->next)
{
- int force_event = p->force_event;
time_t now = time(0);
if (p->destroyed)
continue;
}
p->this_event = 0;
- p->force_event = 0;
- if ((p->max_idle && now - p->last_event > p->max_idle)
- || force_event == EVENT_TIMEOUT)
+ if (p->max_idle && now - p->last_event > p->max_idle)
{
p->last_event = now;
p->this_event |= EVENT_TIMEOUT;
}
if (p->fd >= 0)
{
- if (FD_ISSET(p->fd, &in) || force_event == EVENT_INPUT)
+ if (FD_ISSET(p->fd, &in))
{
p->last_event = now;
- yaz_log(YLOG_DEBUG, "Eventl input event");
p->this_event |= EVENT_INPUT;
}
- if (FD_ISSET(p->fd, &out) || force_event == EVENT_OUTPUT)
+ if (FD_ISSET(p->fd, &out))
{
p->last_event = now;
- yaz_log(YLOG_DEBUG, "Eventl output event");
p->this_event |= EVENT_OUTPUT;
}
- if (FD_ISSET(p->fd, &except) || force_event == EVENT_EXCEPT)
+ if (FD_ISSET(p->fd, &except))
{
p->last_event = now;
p->this_event |= EVENT_EXCEPT;