split evt loop
This commit is contained in:
parent
c5d48ecd37
commit
077d357f56
1 changed files with 42 additions and 40 deletions
|
@ -272,9 +272,10 @@ void evt_core_loop(struct evt_core_ctx* ctx) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (n = 0 ; n < num_fd; n++) {
|
|
||||||
// 1. Handle errors
|
// 1. Handle errors
|
||||||
if (events[n].events & (EPOLLERR | EPOLLHUP | EPOLLRDHUP)) {
|
for (n = 0 ; n < num_fd; n++) {
|
||||||
|
if (!(events[n].events & (EPOLLERR | EPOLLHUP | EPOLLRDHUP))) continue;
|
||||||
|
|
||||||
int err_fd = events[n].data.fd;
|
int err_fd = events[n].data.fd;
|
||||||
int evt = events[n].events;
|
int evt = events[n].events;
|
||||||
if (evt & EPOLLRDHUP) fprintf(stderr, "Epoll Read Hup Event fd=%d.\n", err_fd);
|
if (evt & EPOLLRDHUP) fprintf(stderr, "Epoll Read Hup Event fd=%d.\n", err_fd);
|
||||||
|
@ -313,10 +314,11 @@ void evt_core_loop(struct evt_core_ctx* ctx) {
|
||||||
fprintf(stderr, "The file descriptor %d is not registered in a category, this is probably a logic error\n", err_fd);
|
fprintf(stderr, "The file descriptor %d is not registered in a category, this is probably a logic error\n", err_fd);
|
||||||
close (err_fd);
|
close (err_fd);
|
||||||
}
|
}
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Fetch info and call appropriate function
|
// 2. Fetch info and call appropriate function
|
||||||
|
for (n = 0 ; n < num_fd; n++) {
|
||||||
|
if (events[n].events & (EPOLLERR | EPOLLHUP | EPOLLRDHUP)) continue;
|
||||||
fdinfo = g_hash_table_lookup(ctx->socklist, &(events[n].data.fd));
|
fdinfo = g_hash_table_lookup(ctx->socklist, &(events[n].data.fd));
|
||||||
if (fdinfo == NULL) {
|
if (fdinfo == NULL) {
|
||||||
fprintf(stderr, "Ignoring file descriptor %d as it is not registered. This is a bug.\n", events[n].data.fd);
|
fprintf(stderr, "Ignoring file descriptor %d as it is not registered. This is a bug.\n", events[n].data.fd);
|
||||||
|
|
Loading…
Reference in a new issue