[vlc-devel] [PATCH 7/8] raop: Add loop for request retry

Michael Hanselmann public at hansmi.ch
Sat Jan 10 00:46:52 CET 2009


This loop will be used by authentication.
---
 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 7dd1f9c..2e18b6b 100644
--- a/modules/stream_out/raop.c
+++ b/modules/stream_out/raop.c
@@ -856,37 +856,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:
-- 
1.5.6.3




More information about the vlc-devel mailing list