mirror of https://github.com/xqemu/xqemu.git
curl: Ensure all informationals are checked for completion
According to the documentation, the correct way to ensure all informationals have been returned by curl_multi_info_read is to loop until it returns NULL. 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>
This commit is contained in:
parent
838ef60249
commit
1f2cead324
13
block/curl.c
13
block/curl.c
|
@ -248,18 +248,15 @@ static void curl_multi_check_completion(BDRVCURLState *s)
|
||||||
|
|
||||||
/* Try to find done transfers, so we can free the easy
|
/* Try to find done transfers, so we can free the easy
|
||||||
* handle again. */
|
* handle again. */
|
||||||
do {
|
for (;;) {
|
||||||
CURLMsg *msg;
|
CURLMsg *msg;
|
||||||
msg = curl_multi_info_read(s->multi, &msgs_in_queue);
|
msg = curl_multi_info_read(s->multi, &msgs_in_queue);
|
||||||
|
|
||||||
|
/* Quit when there are no more completions */
|
||||||
if (!msg)
|
if (!msg)
|
||||||
break;
|
break;
|
||||||
if (msg->msg == CURLMSG_NONE)
|
|
||||||
break;
|
|
||||||
|
|
||||||
switch (msg->msg) {
|
if (msg->msg == CURLMSG_DONE) {
|
||||||
case CURLMSG_DONE:
|
|
||||||
{
|
|
||||||
CURLState *state = NULL;
|
CURLState *state = NULL;
|
||||||
curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE,
|
curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE,
|
||||||
(char **)&state);
|
(char **)&state);
|
||||||
|
@ -283,11 +280,7 @@ static void curl_multi_check_completion(BDRVCURLState *s)
|
||||||
curl_clean_state(state);
|
curl_clean_state(state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
msgs_in_queue = 0;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} while(msgs_in_queue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void curl_multi_do(void *arg)
|
static void curl_multi_do(void *arg)
|
||||||
|
|
Loading…
Reference in New Issue