mirror of /home/gitosis/repositories/libowfat.git
Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat
https://www.fefe.de/libowfat/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
710 B
25 lines
710 B
#include "io_internal.h" |
|
|
|
int64 io_timeouted() { |
|
tai6464 now; |
|
static size_t ptr; |
|
io_entry* e; |
|
size_t alen=iarray_length(&io_fds); |
|
taia_now(&now); |
|
++ptr; |
|
if (ptr>=alen) ptr=0; |
|
e=iarray_get(&io_fds,ptr); |
|
if (!e) return -1; |
|
for (;ptr<alen; ++ptr,++e) { |
|
if (e->inuse && e->timeout.sec.x && taia_less(&e->timeout,&now)) { |
|
/* we have a timeout */ |
|
if ((e->canread&&e->wantread) || (e->canwrite&&e->wantwrite)) |
|
continue; /* don't count it if we can signal something else */ |
|
return ptr; |
|
} |
|
} |
|
ptr=-1; /* this is for really pathological cases, where more |
|
connections come in all the time and so the timeout |
|
handling does not trigger initially */ |
|
return -1; |
|
}
|
|
|