Commit 16c42171 authored by Youness Alaoui's avatar Youness Alaoui

recv returns 0 if the socket was shutdown, so we must return -1 so the agent stops the source

parent 565e8606
...@@ -200,6 +200,12 @@ socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf) ...@@ -200,6 +200,12 @@ socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf)
int ret; int ret;
ret = recv (sock->fileno, buf, len, 0); ret = recv (sock->fileno, buf, len, 0);
/* recv returns 0 when the peer performed a shutdown.. we must return -1 here
* so that the agent destroys the g_source */
if (ret == 0)
return -1;
if (ret < 0) { if (ret < 0) {
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
if (WSAGetLastError () == WSAEWOULDBLOCK) if (WSAGetLastError () == WSAEWOULDBLOCK)
......
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