[vlc-devel] commit: raop: Add loop for request retry (Michael Hanselmann )

git version control git at videolan.org
Wed Jul 29 18:18:45 CEST 2009


vlc | branch: master | Michael Hanselmann <public at hansmi.ch> | Wed Jul 22 01:06:44 2009 +0200| [64964519f5427753746f94a5d838cdc8b2fbf2b4] | committer: Rémi Denis-Courmont 

raop: Add loop for request retry

This loop will be used by authentication.

Signed-off-by: Michael Hanselmann <public at hansmi.ch>
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=64964519f5427753746f94a5d838cdc8b2fbf2b4
---

 modules/stream_out/raop.c |   60 ++++++++++++++++++++++++--------------------
 1 files changed, 33 insertions(+), 27 deletions(-)

diff --git a/modules/stream_out/raop.c b/modules/stream_out/raop.c
index 27d60a4..1e8c467 100644
--- a/modules/stream_out/raop.c
+++ b/modules/stream_out/raop.c
@@ -793,37 +793,43 @@ static int ExecRequest( vlc_object_t *p_this, const char *psz_method,
         goto error;
     }
 
-    /* Send request */
-    i_err = SendRequest( p_this, psz_method, psz_content_type, psz_body,
-                         p_req_headers);
-    if ( i_err != VLC_SUCCESS )
-        goto error;
-
-    /* Read status line */
-    i_status = ReadStatusLine( p_this );
-    if ( i_status < 0 )
+    while ( 1 )
     {
-        i_err = i_status;
-        goto error;
-    }
-
-    vlc_dictionary_clear( p_resp_headers, FreeHeader, NULL );
-
-    /* Read headers */
-    headers_done = 0;
-    while ( !headers_done )
-    {
-        i_err = ReadHeader( p_this, p_resp_headers, &headers_done );
+        /* Send request */
+        i_err = SendRequest( p_this, psz_method, psz_content_type, psz_body,
+                             p_req_headers);
         if ( i_err != VLC_SUCCESS )
             goto error;
-    }
 
-    if ( i_status != 200 )
-    {
-        msg_Err( p_this, "Request failed (%s), status is %d",
-                 p_sys->psz_last_status_line, i_status );
-        i_err = VLC_EGENERIC;
-        goto error;
+        /* Read status line */
+        i_status = ReadStatusLine( p_this );
+        if ( i_status < 0 )
+        {
+            i_err = i_status;
+            goto error;
+        }
+
+        vlc_dictionary_clear( p_resp_headers, FreeHeader, NULL );
+
+        /* Read headers */
+        headers_done = 0;
+        while ( !headers_done )
+        {
+            i_err = ReadHeader( p_this, p_resp_headers, &headers_done );
+            if ( i_err != VLC_SUCCESS )
+                goto error;
+        }
+
+        if ( i_status == 200 )
+            /* Request successful */
+            break;
+        else
+        {
+            msg_Err( p_this, "Request failed (%s), status is %d",
+                     p_sys->psz_last_status_line, i_status );
+            i_err = VLC_EGENERIC;
+            goto error;
+        }
     }
 
 error:




More information about the vlc-devel mailing list