Skip to content

Commit

Permalink
Merge pull request #124 from dbechrd/patch-1
Browse files Browse the repository at this point in the history
Print warning when disabling SIO_UDP_CONNRESET fails.
  • Loading branch information
gafferongames authored Sep 10, 2024
2 parents cb08e0b + 12390b2 commit efd0c6d
Showing 1 changed file with 7 additions and 1 deletion.
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

0 comments on commit efd0c6d

Please sign in to comment.