Commit 6742a35e authored by Youness Alaoui's avatar Youness Alaoui

replace close by closesocket for windows

parent 50455d76
......@@ -361,7 +361,11 @@ static void
socket_close (NiceSocket *sock)
{
TurnTcpPriv *priv = sock->priv;
#ifdef G_OS_WIN32
closesocket(sock->fileno);
#else
close (sock->fileno);
#endif
g_queue_foreach (&priv->send_queue, (GFunc) free_to_be_sent, NULL);
g_queue_clear (&priv->send_queue);
g_io_channel_unref (priv->io_channel);
......@@ -425,10 +429,11 @@ nice_tcp_turn_socket_new (
#ifdef G_OS_WIN32
if (ret < 0 && WSAGetLastError () != WSAEINPROGRESS) {
closesocket (sockfd);
#else
if (ret < 0 && errno != EINPROGRESS) {
#endif
close (sockfd);
#endif
g_slice_free (NiceSocket, sock);
return NULL;
}
......
......@@ -128,7 +128,11 @@ socket_is_reliable (NiceSocket *sock)
static void
socket_close (NiceSocket *sock)
{
#ifdef G_OS_WIN32
closesocket(sock->fileno);
#else
close (sock->fileno);
#endif
}
......@@ -168,7 +172,11 @@ nice_udp_bsd_socket_new (NiceAddress *addr)
if (!v6)
#endif
{
#ifdef G_OS_WIN32
closesocket(sock->fileno);
#else
close (sockfd);
#endif
sockfd = -1;
}
else
......@@ -217,13 +225,21 @@ nice_udp_bsd_socket_new (NiceAddress *addr)
if(bind (sockfd, (struct sockaddr *) &name, sizeof (name)) != 0) {
g_slice_free (NiceSocket, sock);
#ifdef G_OS_WIN32
closesocket(sock->fileno);
#else
close (sockfd);
#endif
return NULL;
}
if (getsockname (sockfd, (struct sockaddr *) &name, &name_len) != 0) {
g_slice_free (NiceSocket, sock);
#ifdef G_OS_WIN32
closesocket(sock->fileno);
#else
close (sockfd);
#endif
return NULL;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment