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;
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)
}
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;
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;
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;
#define EVENT_OUTPUT 0x02
#define EVENT_EXCEPT 0x04
#define EVENT_TIMEOUT 0x08
- int force_event;
IOC_CALLBACK fun;
IOC_SOCKETFUN socketfun;
IOC_MASKFUN maskfun;
#define iochan_setflag(i, d) ((i)->flags |= d)
#define iochan_clearflag(i, d) ((i)->flags &= ~(d))
#define iochan_getflag(i, d) ((i)->flags & d ? 1 : 0)
-#define iochan_setevent(i, e) ((i)->force_event = (e))
#define iochan_settimeout(i, t) ((i)->max_idle = (t), (i)->last_event = time(0))
#define iochan_activity(i) ((i)->last_event = time(0))
#define iochan_setsocketfun(i, f) ((i)->socketfun = (f))