summaryrefslogtreecommitdiff
path: root/socket
diff options
context:
space:
mode:
Diffstat (limited to 'socket')
-rw-r--r--socket/tcp-bsd.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/socket/tcp-bsd.c b/socket/tcp-bsd.c
index 5b3ed9f..6694a11 100644
--- a/socket/tcp-bsd.c
+++ b/socket/tcp-bsd.c
@@ -200,6 +200,12 @@ socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf)
int ret;
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) {
#ifdef G_OS_WIN32
if (WSAGetLastError () == WSAEWOULDBLOCK)