Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print warning when disabling SIO_UDP_CONNRESET fails. #124

Merged
merged 3 commits into from
Sep 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion netcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ struct netcode_socket_holder_t
#define NETCODE_SOCKET_ERROR_BIND_IPV6_FAILED 7
#define NETCODE_SOCKET_ERROR_GET_SOCKNAME_IPV4_FAILED 8
#define NETCODE_SOCKET_ERROR_GET_SOCKNAME_IPV6_FAILED 9
#define NETCODE_SOCKET_ERROR_DISABLE_UDP_PORT_CONNRESET_FAILED 10

void netcode_socket_destroy( struct netcode_socket_t * socket )
{
Expand Down Expand Up @@ -476,7 +477,12 @@ int netcode_socket_create( struct netcode_socket_t * s, struct netcode_address_t
#define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR, 12)
BOOL bNewBehavior = FALSE;
DWORD dwBytesReturned = 0;
WSAIoctl( s->handle, SIO_UDP_CONNRESET, &bNewBehavior, sizeof(bNewBehavior), NULL, 0, &dwBytesReturned, NULL, NULL );
if ( WSAIoctl( s->handle, SIO_UDP_CONNRESET, &bNewBehavior, sizeof(bNewBehavior), NULL, 0, &dwBytesReturned, NULL, NULL ) != 0 )
{
netcode_printf( NETCODE_LOG_LEVEL_ERROR, "error: failed to disable UDP CONNRESET (port unreachable) message reporting on socket\n" );
netcode_socket_destroy( s );
return NETCODE_SOCKET_ERROR_DISABLE_UDP_PORT_CONNRESET_FAILED;
}
#endif

// force IPv6 only if necessary
Expand Down
Loading