Patchwork [PULL,27/31] curl: Remove erroneous sleep waiting for curl completion

login
register
mail settings
Submitter Kevin Wolf
Date April 30, 2014, 6:23 p.m.
Message ID <1398882243-14783-28-git-send-email-kwolf@redhat.com>
Download mbox | patch
Permalink /patch/344274/
State New
Headers show

Comments

Kevin Wolf - April 30, 2014, 6:23 p.m.
From: Matthew Booth <mbooth@redhat.com>

The driver will not start more than a fixed number of curl sessions.
If it needs more, it must wait for the completion of an existing one.
The driver was sleeping, which will prevent the main loop from
running, and therefore the event it's waiting on. It was also directly
calling its internal handler rather than waiting on existing
registered handlers to be called from the main loop.

This change causes it simply to wait for a period of time whilst
allowing the main loop to execute.

Signed-off-by: Matthew Booth <mbooth@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/curl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Patch

diff --git a/block/curl.c b/block/curl.c
index 26c9cac..50bd05f 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -337,8 +337,7 @@  static CURLState *curl_init_state(BDRVCURLState *s)
             break;
         }
         if (!state) {
-            g_usleep(100);
-            curl_multi_do(s);
+            qemu_aio_wait();
         }
     } while(!state);