summaryrefslogtreecommitdiff
path: root/socket/tcp-bsd.c
diff options
context:
space:
mode:
authorYouness Alaoui <youness.alaoui@collabora.co.uk>2008-12-09 14:41:52 -0500
committerYouness Alaoui <youness.alaoui@collabora.co.uk>2008-12-09 14:41:52 -0500
commit16c42171061a0419b13a1f9b796253e53c70f583 (patch)
tree2063047c9a8427dbbeba7738870138019ce26bd7 /socket/tcp-bsd.c
parent565e86069a3d19a92a3aa338a7bb73493dcdac02 (diff)
downloadlibnice-16c42171061a0419b13a1f9b796253e53c70f583.tar.gz
recv returns 0 if the socket was shutdown, so we must return -1 so the agent stops the source
Diffstat (limited to 'socket/tcp-bsd.c')
-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)