public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: make sure failed sockets always signal writability
@ 2020-07-16  8:58 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2020-07-16  8:58 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=aa86784937ec7868c358dd90ea5e5324f0be750d

commit aa86784937ec7868c358dd90ea5e5324f0be750d
Author: Marc Hoersken <info@marc-hoersken.de>
Date:   Wed Jul 15 20:53:21 2020 +0200

    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

Diff:
---
 winsup/cygwin/fhandler_socket_inet.cc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/winsup/cygwin/fhandler_socket_inet.cc b/winsup/cygwin/fhandler_socket_inet.cc
index 74c415d60..e5b0d2d14 100644
--- a/winsup/cygwin/fhandler_socket_inet.cc
+++ b/winsup/cygwin/fhandler_socket_inet.cc
@@ -376,6 +376,12 @@ fhandler_socket_wsock::evaluate_events (const long event_mask, long &events,
       if (erase)
 	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;
 
   return ret;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-07-16  8:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16  8:58 [newlib-cygwin] Cygwin: make sure failed sockets always signal writability Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).