Cygwin: make sure failed sockets always signal writability
Since FD_CONNECT is only given once, we manually need to set FD_WRITE for connection failed sockets to have consistent behaviour in programs calling poll/select multiple times. Example test to non-listening port: curl -v 127.0.0.1:47
This commit is contained in:
parent
9397816de7
commit
55165a1ae3
|
@ -376,6 +376,12 @@ fhandler_socket_wsock::evaluate_events (const long event_mask, long &events,
|
||||||
if (erase)
|
if (erase)
|
||||||
wsock_events->events &= ~(events & ~(FD_WRITE | FD_CLOSE));
|
wsock_events->events &= ~(events & ~(FD_WRITE | FD_CLOSE));
|
||||||
}
|
}
|
||||||
|
/* Since FD_CONNECT is only given once, we manually need to set
|
||||||
|
FD_WRITE for connection failed sockets to have consistent
|
||||||
|
behaviour in programs calling poll/select multiple times.
|
||||||
|
Example test to non-listening port: curl -v 127.0.0.1:47 */
|
||||||
|
if ((connect_state () == connect_failed) && (event_mask & FD_WRITE))
|
||||||
|
wsock_events->events |= FD_WRITE;
|
||||||
UNLOCK_EVENTS;
|
UNLOCK_EVENTS;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue