From 42f6a2bca1a74151bee3c1581e5c6de464e244c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EB=AC=B8=ED=98=95?= Date: Thu, 27 Nov 2008 11:22:56 +0000 Subject: [PATCH] gst/rtsp/gstrtspsrc.c: Prevent further read/write actions taken to the connect-failed socket by erroring out quickly.... MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Original commit message from CVS: Patch by: 이문형 * gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_loop_udp): Prevent further read/write actions taken to the connect-failed socket by erroring out quickly. See #562258. --- ChangeLog | 8 ++++++++ gst/rtsp/gstrtspsrc.c | 16 ++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5123a4ce28..3714c29e75 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-11-27 Wim Taymans + + Patch by: 이문형 + + * gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_loop_udp): + Prevent further read/write actions taken to the connect-failed socket by + erroring out quickly. See #562258. + 2008-11-26 Stefan Kost * tests/examples/level/level-example.c: diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index 814cab8d33..6bc6fc371f 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -2914,7 +2914,10 @@ gst_rtspsrc_loop_udp (GstRTSPSrc * src) GST_ELEMENT_WARNING (src, RESOURCE, READ, (NULL), ("The server closed the connection.")); gst_rtsp_connection_close (src->connection); - gst_rtsp_connection_connect (src->connection, src->ptcp_timeout); + res = + gst_rtsp_connection_connect (src->connection, src->ptcp_timeout); + if (res < 0) + goto connect_error; continue; default: goto receive_error; @@ -3025,11 +3028,20 @@ handle_request_failed: g_free (str); return GST_FLOW_ERROR; } +connect_error: + { + gchar *str = gst_rtsp_strresult (res); + + GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ_WRITE, (NULL), + ("Could not connect to server. (%s)", str)); + g_free (str); + return GST_FLOW_ERROR; + } no_protocols: { src->cur_protocols = 0; /* no transport possible, post an error and stop */ - GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL), + GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ_WRITE, (NULL), ("Could not connect to server, no protocols left")); return GST_FLOW_ERROR; }