mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-04 13:15:36 +08:00
Fix receive on UDP connections
Should only read on outgoing or listening "connections" PUBLISHED_FROM=e84ff26b899a5f29ddef29ad6c5ba1d18e76e4ad
This commit is contained in:
parent
6c4fecc4f7
commit
2fc1ff68cf
@ -3786,7 +3786,10 @@ time_t mg_mgr_poll(struct mg_mgr *mgr, int timeout_ms) {
|
|||||||
int fd_flags = 0;
|
int fd_flags = 0;
|
||||||
if (nc->sock != INVALID_SOCKET) {
|
if (nc->sock != INVALID_SOCKET) {
|
||||||
if (num_ev > 0) {
|
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, &write_set) ? _MG_F_FD_CAN_WRITE : 0) |
|
||||||
(FD_ISSET(nc->sock, &err_set) ? _MG_F_FD_ERROR : 0);
|
(FD_ISSET(nc->sock, &err_set) ? _MG_F_FD_ERROR : 0);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user