mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2025-08-18 01:15:46 +00:00
Disable WSAECONNRESET errors for UDP sockets on Windows
This commit is contained in:
parent
7549243f40
commit
252a50bb75
@ -10,6 +10,11 @@
|
|||||||
#define TCPv6_MSS 1220
|
#define TCPv6_MSS 1220
|
||||||
|
|
||||||
#if defined(LC_WINDOWS)
|
#if defined(LC_WINDOWS)
|
||||||
|
|
||||||
|
#ifndef SIO_UDP_CONNRESET
|
||||||
|
#define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR, 12)
|
||||||
|
#endif
|
||||||
|
|
||||||
static HMODULE WlanApiLibraryHandle;
|
static HMODULE WlanApiLibraryHandle;
|
||||||
static HANDLE WlanHandle;
|
static HANDLE WlanHandle;
|
||||||
|
|
||||||
@ -246,12 +251,21 @@ SOCKET bindUdpSocket(int addrfamily, int bufferSize) {
|
|||||||
return INVALID_SOCKET;
|
return INVALID_SOCKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LC_DARWIN
|
#if defined(LC_DARWIN)
|
||||||
{
|
{
|
||||||
// Disable SIGPIPE on iOS
|
// Disable SIGPIPE on iOS
|
||||||
int val = 1;
|
int val = 1;
|
||||||
setsockopt(s, SOL_SOCKET, SO_NOSIGPIPE, (char*)&val, sizeof(val));
|
setsockopt(s, SOL_SOCKET, SO_NOSIGPIPE, (char*)&val, sizeof(val));
|
||||||
}
|
}
|
||||||
|
#elif defined(LC_WINDOWS)
|
||||||
|
{
|
||||||
|
// Disable WSAECONNRESET for UDP sockets on Windows
|
||||||
|
BOOL val = FALSE;
|
||||||
|
DWORD bytesReturned = 0;
|
||||||
|
if (WSAIoctl(s, SIO_UDP_CONNRESET, &val, sizeof(val), NULL, 0, &bytesReturned, NULL, NULL) != 0) {
|
||||||
|
Limelog("WSAIoctl(SIO_UDP_CONNRESET) failed: %d\n", LastSocketError());
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// We start at the requested recv buffer value and step down until we find
|
// We start at the requested recv buffer value and step down until we find
|
||||||
|
Loading…
x
Reference in New Issue
Block a user