rtsp: Cleanup the error path
Make sure the watch is removed when we close the read socket because of an error.
This commit is contained in:
parent
ad5632586a
commit
2fc85d3980
@ -2733,6 +2733,8 @@ struct _GstRTSPWatch
|
|||||||
GSource *readsrc;
|
GSource *readsrc;
|
||||||
GSource *writesrc;
|
GSource *writesrc;
|
||||||
|
|
||||||
|
gboolean keep_running;
|
||||||
|
|
||||||
/* queued message for transmission */
|
/* queued message for transmission */
|
||||||
guint id;
|
guint id;
|
||||||
GMutex mutex;
|
GMutex mutex;
|
||||||
@ -2868,21 +2870,21 @@ eof:
|
|||||||
if (watch->funcs.closed)
|
if (watch->funcs.closed)
|
||||||
watch->funcs.closed (watch, watch->user_data);
|
watch->funcs.closed (watch, watch->user_data);
|
||||||
|
|
||||||
/* always stop when the readfd returns EOF in non-tunneled mode */
|
/* we closed the read connection, stop the watch now */
|
||||||
|
watch->keep_running = FALSE;
|
||||||
|
|
||||||
|
/* always stop when the input returns EOF in non-tunneled mode */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
read_error:
|
read_error:
|
||||||
{
|
{
|
||||||
if (watch->funcs.error_full)
|
if (watch->funcs.error_full)
|
||||||
GST_RTSP_CHECK (watch->funcs.error_full (watch, res, &watch->message,
|
watch->funcs.error_full (watch, res, &watch->message,
|
||||||
0, watch->user_data), error);
|
0, watch->user_data);
|
||||||
}
|
else if (watch->funcs.error)
|
||||||
error:
|
|
||||||
{
|
|
||||||
if (watch->funcs.error)
|
|
||||||
watch->funcs.error (watch, res, watch->user_data);
|
watch->funcs.error (watch, res, watch->user_data);
|
||||||
|
|
||||||
return FALSE;
|
goto eof;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2949,15 +2951,16 @@ write_blocked:
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
eof:
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
write_error:
|
write_error:
|
||||||
{
|
{
|
||||||
if (watch->funcs.error_full)
|
if (watch->funcs.error_full)
|
||||||
GST_RTSP_CHECK (watch->funcs.error_full (watch, res, NULL,
|
watch->funcs.error_full (watch, res, NULL,
|
||||||
watch->write_id, watch->user_data), error);
|
watch->write_id, watch->user_data);
|
||||||
}
|
else if (watch->funcs.error)
|
||||||
error:
|
|
||||||
{
|
|
||||||
if (watch->funcs.error)
|
|
||||||
watch->funcs.error (watch, res, watch->user_data);
|
watch->funcs.error (watch, res, watch->user_data);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -3041,6 +3044,7 @@ gst_rtsp_watch_new (GstRTSPConnection * conn,
|
|||||||
result->messages = g_queue_new ();
|
result->messages = g_queue_new ();
|
||||||
|
|
||||||
gst_rtsp_watch_reset (result);
|
gst_rtsp_watch_reset (result);
|
||||||
|
result->keep_running = TRUE;
|
||||||
|
|
||||||
result->funcs = *funcs;
|
result->funcs = *funcs;
|
||||||
result->user_data = user_data;
|
result->user_data = user_data;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user