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:
Pascal Buhler 2010-05-26 13:42:10 +02:00 committed by Ole André Vadla Ravnås
parent 01b77666bc
commit 9cd134d9fb

View File

@ -624,6 +624,16 @@ g_socket (gint domain,
fcntl (fd, F_SETFD, flags); 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 #endif
return fd; return fd;