[glib: 1/2] gsocket: Improve default UDP behavior on Windows
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/2] gsocket: Improve default UDP behavior on Windows
- Date: Thu, 7 Jan 2021 14:09:21 +0000 (UTC)
commit 9cd134d9fbe06b4324dc3097b2f7f482bd8926cd
Author: Pascal Buhler <pascal buhler tandberg com>
Date: Wed May 26 13:42:10 2010 +0200
gsocket: Improve default UDP behavior on Windows
An ICMP port unreachable will result in a socket error, which is a
really bad default for UDP sockets.
gio/gsocket.c | 10 ++++++++++
1 file changed, 10 insertions(+)
---
diff --git a/gio/gsocket.c b/gio/gsocket.c
index 5d8ecfb9c..543cfe927 100644
--- a/gio/gsocket.c
+++ b/gio/gsocket.c
@@ -624,6 +624,16 @@ g_socket (gint domain,
fcntl (fd, F_SETFD, flags);
}
}
+#else
+ if ((domain == AF_INET || domain == AF_INET6) && type == SOCK_DGRAM)
+ {
+ BOOL new_behavior = FALSE;
+ DWORD bytes_returned = 0;
+
+ /* Disable connection reset error on ICMP port unreachable. */
+ WSAIoctl (fd, SIO_UDP_CONNRESET, &new_behavior, sizeof (new_behavior),
+ NULL, 0, &bytes_returned, NULL, NULL);
+ }
#endif
return fd;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]