summaryrefslogtreecommitdiff
path: root/recipes/glib
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/glib')
-rw-r--r--recipes/glib/0001-Windows-fix-FD_READ-condition-flag-still-set-on-reco.patch34
-rw-r--r--recipes/glib/0001-gioerror-Map-WSAENETRESET-on-Windows-to-G_IO_ERROR_C.patch34
2 files changed, 68 insertions, 0 deletions
diff --git a/recipes/glib/0001-Windows-fix-FD_READ-condition-flag-still-set-on-reco.patch b/recipes/glib/0001-Windows-fix-FD_READ-condition-flag-still-set-on-reco.patch
new file mode 100644
index 00000000..c2a91d30
--- /dev/null
+++ b/recipes/glib/0001-Windows-fix-FD_READ-condition-flag-still-set-on-reco.patch
@@ -0,0 +1,34 @@
+From 6900d53ed863a3e3d7e4e36376ac811ab0cca531 Mon Sep 17 00:00:00 2001
+From: Marco Mastropaolo <marco@mastropaolo.com>
+Date: Thu, 24 Dec 2020 09:08:40 +0000
+Subject: [PATCH] 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,
+--
+2.31.0
+
diff --git a/recipes/glib/0001-gioerror-Map-WSAENETRESET-on-Windows-to-G_IO_ERROR_C.patch b/recipes/glib/0001-gioerror-Map-WSAENETRESET-on-Windows-to-G_IO_ERROR_C.patch
new file mode 100644
index 00000000..2ff28be9
--- /dev/null
+++ b/recipes/glib/0001-gioerror-Map-WSAENETRESET-on-Windows-to-G_IO_ERROR_C.patch
@@ -0,0 +1,34 @@
+From a8acbba46a3161add008d50830740fb0201f560a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= <sebastian@centricular.com>
+Date: Mon, 17 Aug 2020 13:11:22 +0300
+Subject: [PATCH] gioerror: Map WSAENETRESET on Windows to
+ G_IO_ERROR_CONNECTION_CLOSED
+
+This has almost the same semantics as WSAECONNRESET and for all
+practical purposes is handled the same. The main difference is about
+*who* reset the connection: the peer or something in the network.
+
+For UDP sockets this happens when receiving packets and previously sent
+packets returned an ICMP "Time(-to-live) expired" message. This is
+similar to WSAECONNRESET, which on UDP sockets happens when receiving
+packets and previously sent packets returned an ICMP "Port Unreachable"
+message.
+---
+ gio/gioerror.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/gio/gioerror.c b/gio/gioerror.c
+index 1ec120d98..477906c0c 100644
+--- a/gio/gioerror.c
++++ b/gio/gioerror.c
+@@ -343,6 +343,7 @@ g_io_error_from_win32_error (gint error_code)
+ return G_IO_ERROR_NOT_SUPPORTED;
+
+ case WSAECONNRESET:
++ case WSAENETRESET:
+ case WSAESHUTDOWN:
+ return G_IO_ERROR_CONNECTION_CLOSED;
+
+--
+2.31.0
+