[glib: 1/2] Windows: fix FD_READ condition flag still set on recoverable UDP socket errors.
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/2] Windows: fix FD_READ condition flag still set on recoverable UDP socket errors.
- Date: Thu, 24 Dec 2020 09:08:42 +0000 (UTC)
commit 43b13d7a1ac1170394fdaef1bc628d84ee747f60
Author: Marco Mastropaolo <marco mastropaolo com>
Date: Thu Dec 24 09:08:40 2020 +0000
Windows: fix FD_READ condition flag still set on recoverable UDP socket errors.
Contrary to what the WSARecvFrom seem to imply, a UDP socket is perfectly recoverable and usable after a
WSAECONNRESET error (and, I assume, WSAENETRESET).
However GSocket condition has the FD_READ bit set after a UDP socket fails with WSAECONNRESET, even if no
data is available on the socket anymore; this causes select calls to report the socket as readable when, in
fact, it's not.
The change resets FD_READ flag on a socket upon the above error conditions; there's no 'if' to filter
between datagram and stream sockets as the change should be harmless in the case of stream sockets which are,
however, very unlikely to be usable after a WSAECONNRESET.
gio/gsocket.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gio/gsocket.c b/gio/gsocket.c
index 0f8f9259f..e911de781 100644
--- a/gio/gsocket.c
+++ b/gio/gsocket.c
@@ -5475,10 +5475,10 @@ g_socket_receive_message_with_timeout (GSocket *socket,
if (errsv == WSAEINTR)
continue;
+ win32_unset_event_mask (socket, FD_READ);
+
if (errsv == WSAEWOULDBLOCK)
{
- win32_unset_event_mask (socket, FD_READ);
-
if (timeout_us != 0)
{
if (!block_on_timeout (socket, G_IO_IN, timeout_us,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]