mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 23:16:14 +01:00
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.
This commit is contained in:
parent
01b77666bc
commit
9cd134d9fb
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user