[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 25/55] curl: Check completion in curl_multi_do()
From: |
Michael Roth |
Subject: |
[PATCH 25/55] curl: Check completion in curl_multi_do() |
Date: |
Tue, 5 Nov 2019 14:52:13 -0600 |
From: Max Reitz <address@hidden>
While it is more likely that transfers complete after some file
descriptor has data ready to read, we probably should not rely on it.
Better be safe than sorry and call curl_multi_check_completion() in
curl_multi_do(), too, just like it is done in curl_multi_read().
With this change, curl_multi_do() and curl_multi_read() are actually the
same, so drop curl_multi_read() and use curl_multi_do() as the sole FD
handler.
Signed-off-by: Max Reitz <address@hidden>
Message-id: address@hidden
Reviewed-by: Maxim Levitsky <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
(cherry picked from commit 948403bcb1c7e71dcbe8ab8479cf3934a0efcbb5)
Signed-off-by: Michael Roth <address@hidden>
---
block/curl.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/block/curl.c b/block/curl.c
index 95d7b77dc0..5838afef99 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -139,7 +139,6 @@ typedef struct BDRVCURLState {
static void curl_clean_state(CURLState *s);
static void curl_multi_do(void *arg);
-static void curl_multi_read(void *arg);
#ifdef NEED_CURL_TIMER_CALLBACK
/* Called from curl_multi_do_locked, with s->mutex held. */
@@ -186,7 +185,7 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int
action,
switch (action) {
case CURL_POLL_IN:
aio_set_fd_handler(s->aio_context, fd, false,
- curl_multi_read, NULL, NULL, state);
+ curl_multi_do, NULL, NULL, state);
break;
case CURL_POLL_OUT:
aio_set_fd_handler(s->aio_context, fd, false,
@@ -194,7 +193,7 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int
action,
break;
case CURL_POLL_INOUT:
aio_set_fd_handler(s->aio_context, fd, false,
- curl_multi_read, curl_multi_do, NULL, state);
+ curl_multi_do, curl_multi_do, NULL, state);
break;
case CURL_POLL_REMOVE:
aio_set_fd_handler(s->aio_context, fd, false,
@@ -416,15 +415,6 @@ static void curl_multi_do(void *arg)
{
CURLState *s = (CURLState *)arg;
- qemu_mutex_lock(&s->s->mutex);
- curl_multi_do_locked(s);
- qemu_mutex_unlock(&s->s->mutex);
-}
-
-static void curl_multi_read(void *arg)
-{
- CURLState *s = (CURLState *)arg;
-
qemu_mutex_lock(&s->s->mutex);
curl_multi_do_locked(s);
curl_multi_check_completion(s->s);
--
2.17.1
- [PATCH 55/55] virtio-blk: Cancel the pending BH when the dataplane is reset, (continued)
- [PATCH 55/55] virtio-blk: Cancel the pending BH when the dataplane is reset, Michael Roth, 2019/11/05
- [PATCH 21/55] qcow2: Fix the calculation of the maximum L2 cache size, Michael Roth, 2019/11/05
- [PATCH 44/55] iotests: Test large write request to qcow2 file, Michael Roth, 2019/11/05
- [PATCH 48/55] virtio-net: prevent offloads reset on migration, Michael Roth, 2019/11/05
- [PATCH 06/55] xen-bus: Fix backend state transition on device reset, Michael Roth, 2019/11/05
- [PATCH 08/55] block/file-posix: Reduce xfsctl() use, Michael Roth, 2019/11/05
- [PATCH 04/55] target/alpha: fix tlb_fill trap_arg2 value for instruction fetch, Michael Roth, 2019/11/05
- [PATCH 43/55] qcow2: Limit total allocation range to INT_MAX, Michael Roth, 2019/11/05
- [PATCH 07/55] xen-bus: check whether the frontend is active during device reset..., Michael Roth, 2019/11/05
- [PATCH 53/55] target/xtensa: regenerate and re-import test_mmuhifi_c3 core, Michael Roth, 2019/11/05
- [PATCH 25/55] curl: Check completion in curl_multi_do(),
Michael Roth <=
- [PATCH 13/55] iotests: add testing shim for script-style python tests, Michael Roth, 2019/11/05
- [PATCH 49/55] COLO-compare: Fix incorrect `if` logic, Michael Roth, 2019/11/05
- [PATCH 41/55] vhost-user: save features if the char dev is closed, Michael Roth, 2019/11/05
- [PATCH 40/55] iotests: Test internal snapshots with -blockdev, Michael Roth, 2019/11/05
- [PATCH 54/55] scsi: lsi: exit infinite loop while executing script (CVE-2019-12068), Michael Roth, 2019/11/05
- [PATCH 37/55] roms/Makefile.edk2: don't pull in submodules when building from tarball, Michael Roth, 2019/11/05
- [PATCH 10/55] pr-manager: Fix invalid g_free() crash bug, Michael Roth, 2019/11/05
- Re: [PATCH 00/55] Patch Round-up for stable 4.1.1, freeze on 2019-11-12, Max Reitz, 2019/11/08
- Re: [PATCH 00/55] Patch Round-up for stable 4.1.1, freeze on 2019-11-12, Cole Robinson, 2019/11/11