summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Deseyn <tom.deseyn@gmail.com>2016-01-28 16:26:47 +0100
committerTim-Philipp Müller <tim@centricular.com>2016-04-06 13:08:04 +0100
commit128edf816355f890048a81d383176582bea02eb9 (patch)
treed0ccc0cdda61709ffcb32b454cb5b2dc0e424df5
parenta60aa8c573cd3d70fb75d4ae807db93cc6f4ac6a (diff)
downloadgstreamer-plugins-base-128edf816355f890048a81d383176582bea02eb9.tar.gz
multisocketsink: handle client close correctly and EWOULDBLOCK
Fixes 100% cpu usage when client disconnects. Commit 6db2ee56 would just make multisocketsink ignore reads of 0 bytes without removing the client, so we'd get woken up over and over again for the client. Fix the original issue differently by handling the non-fatal error code. https://bugzilla.gnome.org/show_bug.cgi?id=761257 https://bugzilla.gnome.org/show_bug.cgi?id=743834
-rw-r--r--gst/tcp/gstmultisocketsink.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gst/tcp/gstmultisocketsink.c b/gst/tcp/gstmultisocketsink.c
index cf5a4a573..912bc856b 100644
--- a/gst/tcp/gstmultisocketsink.c
+++ b/gst/tcp/gstmultisocketsink.c
@@ -575,7 +575,7 @@ gst_multi_socket_sink_handle_client_read (GstMultiSocketSink * sink,
GST_DEBUG_OBJECT (sink, "%s client wants us to read", mhclient->debug);
navail = g_socket_get_available_bytes (mhclient->handle.socket);
- if (navail <= 0)
+ if (navail < 0)
break;
nread =
@@ -588,6 +588,9 @@ gst_multi_socket_sink_handle_client_read (GstMultiSocketSink * sink,
mhclient->status = GST_CLIENT_STATUS_CLOSED;
ret = FALSE;
} else if (nread < 0) {
+ if (err->code == G_IO_ERROR_WOULD_BLOCK)
+ break;
+
GST_WARNING_OBJECT (sink, "%s could not read: %s",
mhclient->debug, err->message);
mhclient->status = GST_CLIENT_STATUS_ERROR;