1
0
Fork 0

Fix gateway socket hangup handling. Speed-up gateway processing.

This commit is contained in:
Janez 2020-10-26 17:53:41 +01:00
parent e3157fabee
commit 65464f8f5a
2 changed files with 8 additions and 5 deletions

View file

@ -533,10 +533,6 @@ void CO_epoll_processGtw(CO_epoll_gtw_t *epGtw,
&& (ep->ev.data.fd == epGtw->gtwa_fdSocket && (ep->ev.data.fd == epGtw->gtwa_fdSocket
|| ep->ev.data.fd == epGtw->gtwa_fd) || ep->ev.data.fd == epGtw->gtwa_fd)
) { ) {
if ((ep->ev.events & (EPOLLERR | EPOLLHUP)) != 0) {
log_printf(LOG_DEBUG, DBG_GENERAL,
"socket error or hangup, event=", ep->ev.events);
}
if ((ep->ev.events & EPOLLIN) != 0 if ((ep->ev.events & EPOLLIN) != 0
&& ep->ev.data.fd == epGtw->gtwa_fdSocket && ep->ev.data.fd == epGtw->gtwa_fdSocket
) { ) {
@ -626,6 +622,13 @@ void CO_epoll_processGtw(CO_epoll_gtw_t *epGtw,
ep->epoll_new = false; ep->epoll_new = false;
} }
else if ((ep->ev.events & (EPOLLERR | EPOLLHUP)) != 0) {
log_printf(LOG_DEBUG, DBG_GENERAL,
"socket error or hangup, event=", ep->ev.events);
if (close(epGtw->gtwa_fd) < 0) {
log_printf(LOG_CRIT, DBG_ERRNO, "close(gtwa_fd, hangup)");
}
}
} /* if (ep->epoll_new) */ } /* if (ep->epoll_new) */
/* if socket connection is established, verify timeout */ /* if socket connection is established, verify timeout */

View file

@ -549,10 +549,10 @@ int main (int argc, char *argv[]) {
#ifdef CO_SINGLE_THREAD #ifdef CO_SINGLE_THREAD
CO_epoll_processRT(&epMain, CO, false); CO_epoll_processRT(&epMain, CO, false);
#endif #endif
CO_epoll_processMain(&epMain, CO, &reset);
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII #if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII
CO_epoll_processGtw(&epGtw, CO, &epMain); CO_epoll_processGtw(&epGtw, CO, &epMain);
#endif #endif
CO_epoll_processMain(&epMain, CO, &reset);
CO_epoll_processLast(&epMain); CO_epoll_processLast(&epMain);
#ifdef CO_USE_APPLICATION #ifdef CO_USE_APPLICATION