Beispiel #1
0
/*
 * Process the results of a call to select(). <r> is select's return value, <rfds> and <wfds>
 * contain the file descriptors that select has marked as readable or writable and <nfds> is the
 * maximum number of file descriptors that may be set in <rfds> or <wfds>.
 */
void disProcessSelect(Dispatcher *dis, int r, int nfds, fd_set *rfds, fd_set *wfds)
{
P   dbgPrint(stderr, "r = %d, nfds = %d.\n", r, nfds);

P   dumpfds(stderr, "\trfds:", nfds, rfds);
P   dumpfds(stderr, "\twfds:", nfds, wfds);

    if (r == 0) {
P       dbgPrint(stderr, "Timeout, calling disHandleTimer.\n");
        disHandleTimer(dis);
    }
    else if (r > 0) {
P       dbgPrint(stderr, "Data available, calling disHandleFiles.\n");
        disHandleFiles(dis, nfds, rfds, wfds);
    }
}
Beispiel #2
0
/*
 * Process (and subsequently discard) the first pending timeout.
 */
void nsHandleTimer(NS *ns)
{
    disHandleTimer(&ns->dis);
}