Пример #1
0
static void handle_fd0(Dispatcher *dis, int fd, void *udata)
{
    char buffer[16];

    int count = read(fd, buffer, sizeof(buffer));

    make_sure_that(count == 4);
    make_sure_that(strncmp(buffer, "Hoi!", 4) == 0);

    disClose(dis);
}
Пример #2
0
/*
 * Clear the contents of <dis> but don't free <dis> itself.
 */
void disClear(Dispatcher *dis)
{
    disClose(dis);

    memset(dis, 0, sizeof(Dispatcher));
}
Пример #3
0
/*
 * Clear the contents of <dis> and then free <dis> itself. Do not call this from inside the disRun()
 * loop. Instead, call disClose(), wait for disRun() to return and then call disDestroy().
 */
void disDestroy(Dispatcher *dis)
{
    disClose(dis);  /* Just to be sure. */

    free(dis);
}
Пример #4
0
/*
 * Close the network server <ns>. This removes all file descriptors and timers, which will cause
 * nsRun() to return.
 */
void nsClose(NS *ns)
{
    disClose((Dispatcher *) ns);
}