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

replace close by closesocket for windows

parent 50455d76
...@@ -361,7 +361,11 @@ static void ...@@ -361,7 +361,11 @@ static void
socket_close (NiceSocket *sock) socket_close (NiceSocket *sock)
{ {
TurnTcpPriv *priv = sock->priv; TurnTcpPriv *priv = sock->priv;
#ifdef G_OS_WIN32
closesocket(sock->fileno);
#else
close (sock->fileno); close (sock->fileno);
#endif
g_queue_foreach (&priv->send_queue, (GFunc) free_to_be_sent, NULL); g_queue_foreach (&priv->send_queue, (GFunc) free_to_be_sent, NULL);
g_queue_clear (&priv->send_queue); g_queue_clear (&priv->send_queue);
g_io_channel_unref (priv->io_channel); g_io_channel_unref (priv->io_channel);
...@@ -425,10 +429,11 @@ nice_tcp_turn_socket_new ( ...@@ -425,10 +429,11 @@ nice_tcp_turn_socket_new (
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
if (ret < 0 && WSAGetLastError () != WSAEINPROGRESS) { if (ret < 0 && WSAGetLastError () != WSAEINPROGRESS) {
closesocket (sockfd);
#else #else
if (ret < 0 && errno != EINPROGRESS) { if (ret < 0 && errno != EINPROGRESS) {
#endif
close (sockfd); close (sockfd);
#endif
g_slice_free (NiceSocket, sock); g_slice_free (NiceSocket, sock);
return NULL; return NULL;
} }
......
...@@ -128,7 +128,11 @@ socket_is_reliable (NiceSocket *sock) ...@@ -128,7 +128,11 @@ socket_is_reliable (NiceSocket *sock)
static void static void
socket_close (NiceSocket *sock) socket_close (NiceSocket *sock)
{ {
#ifdef G_OS_WIN32
closesocket(sock->fileno);
#else
close (sock->fileno); close (sock->fileno);
#endif
} }
...@@ -168,7 +172,11 @@ nice_udp_bsd_socket_new (NiceAddress *addr) ...@@ -168,7 +172,11 @@ nice_udp_bsd_socket_new (NiceAddress *addr)
if (!v6) if (!v6)
#endif #endif
{ {
#ifdef G_OS_WIN32
closesocket(sock->fileno);
#else
close (sockfd); close (sockfd);
#endif
sockfd = -1; sockfd = -1;
} }
else else
...@@ -217,13 +225,21 @@ nice_udp_bsd_socket_new (NiceAddress *addr) ...@@ -217,13 +225,21 @@ nice_udp_bsd_socket_new (NiceAddress *addr)
if(bind (sockfd, (struct sockaddr *) &name, sizeof (name)) != 0) { if(bind (sockfd, (struct sockaddr *) &name, sizeof (name)) != 0) {
g_slice_free (NiceSocket, sock); g_slice_free (NiceSocket, sock);
#ifdef G_OS_WIN32
closesocket(sock->fileno);
#else
close (sockfd); close (sockfd);
#endif
return NULL; return NULL;
} }
if (getsockname (sockfd, (struct sockaddr *) &name, &name_len) != 0) { if (getsockname (sockfd, (struct sockaddr *) &name, &name_len) != 0) {
g_slice_free (NiceSocket, sock); g_slice_free (NiceSocket, sock);
#ifdef G_OS_WIN32
closesocket(sock->fileno);
#else
close (sockfd); close (sockfd);
#endif
return NULL; 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