Esempio n. 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);
    }
}
Esempio n. 2
0
/*
 * Handle readable and writable file descriptors in <rfds> and <wfds>, with <nfds> set to the
 * maximum number of file descriptors that may be set in <rfds> or <wfds>.
 */
void nsHandleFiles(NS *ns, int nfds, fd_set *rfds, fd_set *wfds)
{
    disHandleFiles(&ns->dis, nfds, rfds, wfds);
}