Fixed SIGPIPE problem (#2411, #2312)

This commit is contained in:
Sukchan Lee 2023-07-26 22:51:26 +09:00
parent 5764f7267d
commit 35356e9d9b
1 changed files with 15 additions and 0 deletions

View File

@ -227,7 +227,22 @@ static int epoll_process(ogs_pollset_t *pollset, ogs_time_t timeout)
received = context->event_list[i].events;
if (received & EPOLLERR) {
/*
* The libevent library has OGS_POLLOUT turned on in EPOLLERR.
*
* However, SIGPIPE can occur if write() is called
* when the peer connection is closed.
*
* Therefore, Open5GS turns off OGS_POLLOUT
* so that write() cannot be called in case of EPOLLERR.
*
* See also #2411 and #2312
*/
#if 0
when = OGS_POLLIN|OGS_POLLOUT;
#else
when = OGS_POLLIN;
#endif
} else if ((received & EPOLLHUP) && !(received & EPOLLRDHUP)) {
when = OGS_POLLIN|OGS_POLLOUT;
} else {