rtspconnection: Handle EOF on writev() after checking for all other error conditions
Otherwise we would return EOF if nothing was written in any case, even if this was actually a case of TIMEOUT or EWOULDBLOCK for example. Thanks to Edward Hervey for debugging and finding this issue.
This commit is contained in:
parent
87a9f2b92c
commit
8a54cc3b16
@ -1269,7 +1269,7 @@ writev_bytes (GOutputStream * stream, GOutputVector * vectors, gint n_vectors,
|
|||||||
g_pollable_output_stream_writev_nonblocking (G_POLLABLE_OUTPUT_STREAM
|
g_pollable_output_stream_writev_nonblocking (G_POLLABLE_OUTPUT_STREAM
|
||||||
(stream), vectors, n_vectors, &written, cancellable, &err);
|
(stream), vectors, n_vectors, &written, cancellable, &err);
|
||||||
_bytes_written += written;
|
_bytes_written += written;
|
||||||
if (G_UNLIKELY (!res))
|
if (G_UNLIKELY (!res || written == 0))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* skip vectors that have been written in full */
|
/* skip vectors that have been written in full */
|
||||||
@ -1295,9 +1295,7 @@ error:
|
|||||||
{
|
{
|
||||||
*bytes_written = _bytes_written;
|
*bytes_written = _bytes_written;
|
||||||
|
|
||||||
if (G_UNLIKELY (written == 0))
|
if (err)
|
||||||
return GST_RTSP_EEOF;
|
|
||||||
|
|
||||||
GST_DEBUG ("%s", err->message);
|
GST_DEBUG ("%s", err->message);
|
||||||
if (g_error_matches (err, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
|
if (g_error_matches (err, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
|
||||||
g_clear_error (&err);
|
g_clear_error (&err);
|
||||||
@ -1308,7 +1306,11 @@ error:
|
|||||||
} else if (g_error_matches (err, G_IO_ERROR, G_IO_ERROR_TIMED_OUT)) {
|
} else if (g_error_matches (err, G_IO_ERROR, G_IO_ERROR_TIMED_OUT)) {
|
||||||
g_clear_error (&err);
|
g_clear_error (&err);
|
||||||
return GST_RTSP_ETIMEOUT;
|
return GST_RTSP_ETIMEOUT;
|
||||||
|
} else if (G_UNLIKELY (written == 0)) {
|
||||||
|
g_clear_error (&err);
|
||||||
|
return GST_RTSP_EEOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_clear_error (&err);
|
g_clear_error (&err);
|
||||||
return GST_RTSP_ESYS;
|
return GST_RTSP_ESYS;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user