Should fix some issues with Win32 netplay.
This commit is contained in:
parent
0485f783b3
commit
7bcc173c5f
|
@ -134,10 +134,15 @@ static bool init_socket(netplay_t *handle, const char *server, uint16_t port)
|
|||
if (getaddrinfo(server, port_buf, &hints, &res) < 0)
|
||||
return false;
|
||||
|
||||
if (!res)
|
||||
return false;
|
||||
|
||||
handle->fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
|
||||
if (handle->fd < 0)
|
||||
{
|
||||
SSNES_ERR("Failed to init socket...\n");
|
||||
|
||||
if (res)
|
||||
freeaddrinfo(res);
|
||||
return false;
|
||||
}
|
||||
|
@ -148,6 +153,7 @@ static bool init_socket(netplay_t *handle, const char *server, uint16_t port)
|
|||
{
|
||||
SSNES_ERR("Failed to connect to server.\n");
|
||||
close(handle->fd);
|
||||
if (res)
|
||||
freeaddrinfo(res);
|
||||
return false;
|
||||
}
|
||||
|
@ -161,6 +167,7 @@ static bool init_socket(netplay_t *handle, const char *server, uint16_t port)
|
|||
{
|
||||
SSNES_ERR("Failed to bind socket.\n");
|
||||
close(handle->fd);
|
||||
if (res)
|
||||
freeaddrinfo(res);
|
||||
return false;
|
||||
}
|
||||
|
@ -169,6 +176,7 @@ static bool init_socket(netplay_t *handle, const char *server, uint16_t port)
|
|||
{
|
||||
SSNES_ERR("Failed to accept socket.\n");
|
||||
close(handle->fd);
|
||||
if (res)
|
||||
freeaddrinfo(res);
|
||||
return false;
|
||||
}
|
||||
|
@ -176,6 +184,7 @@ static bool init_socket(netplay_t *handle, const char *server, uint16_t port)
|
|||
handle->fd = new_fd;
|
||||
}
|
||||
|
||||
if (res)
|
||||
freeaddrinfo(res);
|
||||
|
||||
// No nagle for you!
|
||||
|
|
Loading…
Reference in New Issue