Created
October 3, 2012 18:43
-
-
Save arianvp/3828936 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void accept_cb(EV_P_ ev_io *io, int revents) | |
{ | |
int client_fd; | |
socklen_t len; | |
struct sockaddr_in client_addr; | |
len = sizeof(client_addr); | |
client_fd = accept(io->fd, (struct sockaddr *)&client_addr, &len); | |
fcntl(client_fd, F_SETFL, O_NONBLOCK); | |
ev_io_init(&ctx->io, read_cb, client_fd, EV_READ); | |
ev_io_start(EV_A_ &ctx->io); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment