Show error

This commit is contained in:
Quentin Dufour 2019-02-19 16:40:20 +01:00
parent e5ee229ed8
commit c64aa99593
2 changed files with 8 additions and 2 deletions

View file

@ -165,7 +165,6 @@ void on_tcp_read(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
// 3. A whole packet has been read, we will find someone to write it // 3. A whole packet has been read, we will find someone to write it
sprintf(url, "udp:write:127.0.0.1:%d", bp->ip.ap.str.port); sprintf(url, "udp:write:127.0.0.1:%d", bp->ip.ap.str.port);
printf("wil be forwarded to: %s\n", url);
to_fdinfo = evt_core_get_from_url (ctx, url); to_fdinfo = evt_core_get_from_url (ctx, url);
if (to_fdinfo == NULL) goto co_error; if (to_fdinfo == NULL) goto co_error;

View file

@ -150,7 +150,14 @@ void evt_core_loop(struct evt_core_ctx* ctx) {
int evt = events[n].events; int evt = events[n].events;
if (evt & EPOLLRDHUP) fprintf(stderr, "Epoll Read Hup Event. "); if (evt & EPOLLRDHUP) fprintf(stderr, "Epoll Read Hup Event. ");
if (evt & EPOLLHUP) fprintf(stderr, "Epoll Hup Event. "); if (evt & EPOLLHUP) fprintf(stderr, "Epoll Hup Event. ");
if (evt & EPOLLERR) fprintf(stderr, "Epoll Err Event. "); if (evt & EPOLLERR) {
int error = 0;
socklen_t errlen = sizeof(error);
if (getsockopt(err_fd, SOL_SOCKET, SO_ERROR, (void *)&error, &errlen) == 0) {
printf("Socket %d error = %s\n", err_fd, strerror(error));
}
fprintf(stderr, "Epoll Err Event. ");
}
fdinfo = evt_core_get_from_fd(ctx, err_fd); fdinfo = evt_core_get_from_fd(ctx, err_fd);
if (fdinfo != NULL) { if (fdinfo != NULL) {