Show error
This commit is contained in:
parent
e5ee229ed8
commit
c64aa99593
2 changed files with 8 additions and 2 deletions
|
@ -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
|
||||
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);
|
||||
if (to_fdinfo == NULL) goto co_error;
|
||||
|
||||
|
|
|
@ -150,7 +150,14 @@ void evt_core_loop(struct evt_core_ctx* ctx) {
|
|||
int evt = events[n].events;
|
||||
if (evt & EPOLLRDHUP) fprintf(stderr, "Epoll Read 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);
|
||||
if (fdinfo != NULL) {
|
||||
|
|
Loading…
Reference in a new issue