public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin/main] Revert "Cygwin: select: workaround FD_WRITE network event handling"
Date: Sun, 27 Aug 2023 12:50:50 +0000 (GMT)	[thread overview]
Message-ID: <20230827125050.C774C3858D33@sourceware.org> (raw)

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

commit a841911ea45272b1333134aa0d8bd9b3860a2c7f
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Sat Aug 26 17:59:58 2023 +0200
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Sun Aug 27 14:40:22 2023 +0200

    Revert "Cygwin: select: workaround FD_WRITE network event handling"
    
    This reverts commit dedbbd74d0a8f3b7dfae6188321703a47bb8a2b3.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/autoload.cc |  1 -
 winsup/cygwin/select.cc   | 30 +++---------------------------
 2 files changed, 3 insertions(+), 28 deletions(-)

diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc
index 67149f828266..c9ad92530c83 100644
--- a/winsup/cygwin/autoload.cc
+++ b/winsup/cygwin/autoload.cc
@@ -645,7 +645,6 @@ LoadDLLfunc (getsockname, ws2_32)
 LoadDLLfunc (getsockopt, ws2_32)
 LoadDLLfunc (ioctlsocket, ws2_32)
 LoadDLLfunc (listen, ws2_32)
-LoadDLLfunc_pfx_only (select, ws2_32)
 LoadDLLfunc (setsockopt, ws2_32)
 LoadDLLfunc (shutdown, ws2_32)
 LoadDLLfunc (socket, ws2_32)
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index 7b9473849ec2..bad4c37f3b2e 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -1757,15 +1757,6 @@ fhandler_base::select_except (select_stuff *ss)
   return s;
 }
 
-struct wfd_set
-{
-  u_int   fd_count;
-  SOCKET  fd_array[1];
-};
-
-/* autoload exposes the Winsock select function only with a _win32_ prefix. */
-extern "C" int _win32_select(int, wfd_set *, wfd_set *, wfd_set *, TIMEVAL *);
-
 static int
 peek_socket (select_record *me, bool)
 {
@@ -1781,24 +1772,9 @@ peek_socket (select_record *me, bool)
   if (me->read_selected)
     me->read_ready |= ret || !!(events & (FD_READ | FD_ACCEPT | FD_CLOSE));
   if (me->write_selected)
-    {
-      /* The FD_WRITE event is a false friend. It indicates ready to write
-         even if the next send fails with WSAEWOULDBLOCK.  *After* the fact,
-	 FD_WRITE will be cleared until sending is again possible.
-	 For the time being, workaround that here by using the WinSock
-	 select function.  It indicates writability correctly. */
-      if (events & FD_WRITE)
-	{
-	  wfd_set w = { 1, { fh->get_socket () } };
-	  TIMEVAL t = { 0 };
-
-	  if (_win32_select (0, NULL, &w, NULL, &t) == 0)
-	    events &= ~FD_WRITE;
-	}
-      /* Don't check for FD_CLOSE here.  Only an error case (ret == -1)
-	 will set ready for writing. */
-      me->write_ready |= ret || !!(events & (FD_WRITE | FD_CONNECT));
-    }
+    /* Don't check for FD_CLOSE here.  Only an error case (ret == -1)
+       will set ready for writing. */
+    me->write_ready |= ret || !!(events & (FD_WRITE | FD_CONNECT));
   if (me->except_selected)
     me->except_ready |= !!(events & FD_OOB);

                 reply	other threads:[~2023-08-27 12:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230827125050.C774C3858D33@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).