Commit 2fc1ff68 authored by Deomid Ryabkov's avatar Deomid Ryabkov Committed by rojer

Fix receive on UDP connections

Should only read on outgoing or listening "connections"

PUBLISHED_FROM=e84ff26b899a5f29ddef29ad6c5ba1d18e76e4ad
parent 6c4fecc4
......@@ -3786,7 +3786,10 @@ time_t mg_mgr_poll(struct mg_mgr *mgr, int timeout_ms) {
int fd_flags = 0;
if (nc->sock != INVALID_SOCKET) {
if (num_ev > 0) {
fd_flags = (FD_ISSET(nc->sock, &read_set) ? _MG_F_FD_CAN_READ : 0) |
fd_flags = (FD_ISSET(nc->sock, &read_set) &&
(!(nc->flags & MG_F_UDP) || nc->listener == NULL)
? _MG_F_FD_CAN_READ
: 0) |
(FD_ISSET(nc->sock, &write_set) ? _MG_F_FD_CAN_WRITE : 0) |
(FD_ISSET(nc->sock, &err_set) ? _MG_F_FD_ERROR : 0);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment