mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-03 08:25:47 +03:00
epoll: Stop spin between TCP connect and received data
If a client TCP connection connects, EPOLLOUT remains enabled so epoll_wait() always returns immediately causing a loop until there is other data traffic. This fix is to enable EPOLLIN and disable EPOLLOUT if COAP_SOCKET_WANT_WRITE is not set at point of connection successful.
This commit is contained in:
1 parent
f00be554cc
commit
8c635e709b
1 file changed
+3
@@ -1696,6 +1696,9 @@ coap_io_do_epoll(coap_context_t *ctx, struct epoll_event *events, size_t nevents
|
||||
(events[j].events & (EPOLLOUT|EPOLLERR|EPOLLHUP|EPOLLRDHUP))) {
|
||||
sock->flags |= COAP_SOCKET_CAN_CONNECT;
|
||||
coap_connect_session(session->context, session, now);
|
||||
if (!(sock->flags & COAP_SOCKET_WANT_WRITE)) {
|
||||
coap_epoll_ctl_mod(sock, EPOLLIN, __func__);
|
||||
}
|
||||
}
|
||||
|
||||
if ((sock->flags & COAP_SOCKET_WANT_READ) &&
|
||||
|
||||
Reference in new issue
Block a user