client: Send setup reply once only
authorJonas Holmberg <jonashg@axis.com>
Thu, 26 Sep 2013 07:41:10 +0000 (09:41 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Thu, 26 Sep 2013 12:25:36 +0000 (14:25 +0200)
If find_media() failed in handle_setup_request() two replies was sent.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=708819

gst/rtsp-server/rtsp-client.c

index 1d192a7..f351f24 100644 (file)
@@ -564,11 +564,13 @@ no_factory_access:
   {
     GST_ERROR ("client %p: not authorized to see factory path %s", client,
         path);
+    /* error reply is already sent */
     return NULL;
   }
 not_authorized:
   {
     GST_ERROR ("client %p: not authorized for factory path %s", client, path);
+    /* error reply is already sent */
     return NULL;
   }
 no_media:
@@ -1420,10 +1422,12 @@ handle_setup_request (GstRTSPClient * client, GstRTSPContext * ctx)
   } else {
     if ((media = gst_rtsp_session_media_get_media (sessmedia)))
       g_object_ref (media);
+    else
+      goto media_not_found;
   }
   /* no media, not found then */
   if (media == NULL)
-    goto media_not_found;
+    goto media_not_found_no_reply;
 
   if (path[matched] == '\0')
     goto control_not_found;
@@ -1548,6 +1552,12 @@ no_pool:
     send_generic_response (client, GST_RTSP_STS_SESSION_NOT_FOUND, ctx);
     return FALSE;
   }
+media_not_found_no_reply:
+  {
+    GST_ERROR ("client %p: media '%s' not found", client, path);
+    /* error reply is already sent */
+    return FALSE;
+  }
 media_not_found:
   {
     GST_ERROR ("client %p: media '%s' not found", client, path);
@@ -1980,6 +1990,7 @@ session_not_found:
 not_authorized:
   {
     GST_ERROR ("client %p: not allowed", client);
+    /* error reply is already sent */
     goto done;
   }
 not_implemented: