Commit b12cd543 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

multisocketsink: Fix handling of partial writes and WOULD_BLOCK errors

parent 692fd81a
...@@ -750,18 +750,21 @@ gst_multi_socket_sink_handle_client_write (GstMultiSocketSink * sink, ...@@ -750,18 +750,21 @@ gst_multi_socket_sink_handle_client_write (GstMultiSocketSink * sink,
/* hmm error.. */ /* hmm error.. */
if (g_error_matches (err, G_IO_ERROR, G_IO_ERROR_CLOSED)) { if (g_error_matches (err, G_IO_ERROR, G_IO_ERROR_CLOSED)) {
goto connection_reset; goto connection_reset;
} else if (g_error_matches (err, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) {
/* write would block, try again later */
GST_LOG_OBJECT (sink, "write would block %p",
mhclient->handle.socket);
more = FALSE;
} else { } else {
goto write_error; goto write_error;
} }
} else { } else {
if (wrote < maxsize) { if (wrote < maxsize) {
/* partial write means that the client cannot read more and we should /* partial write, try again now */
* stop sending more */
GST_LOG_OBJECT (sink, GST_LOG_OBJECT (sink,
"partial write on %p of %" G_GSSIZE_FORMAT " bytes", "partial write on %p of %" G_GSSIZE_FORMAT " bytes",
mhclient->handle.socket, wrote); mhclient->handle.socket, wrote);
mhclient->bufoffset += wrote; mhclient->bufoffset += wrote;
more = FALSE;
} else { } else {
/* complete buffer was written, we can proceed to the next one */ /* complete buffer was written, we can proceed to the next one */
mhclient->sending = g_slist_remove (mhclient->sending, head); mhclient->sending = g_slist_remove (mhclient->sending, head);
......
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