[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v2 2/7] curl: Keep *socket until the end of curl
From: |
Maxim Levitsky |
Subject: |
Re: [Qemu-block] [PATCH v2 2/7] curl: Keep *socket until the end of curl_sock_cb() |
Date: |
Tue, 10 Sep 2019 19:11:30 +0300 |
On Tue, 2019-09-10 at 14:41 +0200, Max Reitz wrote:
> This does not really change anything, but it makes the code a bit easier
> to follow once we use @socket as the opaque pointer for
> aio_set_fd_handler().
>
> Cc: address@hidden
> Signed-off-by: Max Reitz <address@hidden>
> ---
> block/curl.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/block/curl.c b/block/curl.c
> index 92dc2f630e..95d7b77dc0 100644
> --- a/block/curl.c
> +++ b/block/curl.c
> @@ -172,10 +172,6 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd,
> int action,
>
> QLIST_FOREACH(socket, &state->sockets, next) {
> if (socket->fd == fd) {
> - if (action == CURL_POLL_REMOVE) {
> - QLIST_REMOVE(socket, next);
> - g_free(socket);
> - }
> break;
> }
> }
> @@ -185,7 +181,6 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int
> action,
> socket->state = state;
> QLIST_INSERT_HEAD(&state->sockets, socket, next);
> }
> - socket = NULL;
>
> trace_curl_sock_cb(action, (int)fd);
> switch (action) {
> @@ -207,6 +202,11 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd,
> int action,
> break;
> }
>
> + if (action == CURL_POLL_REMOVE) {
> + QLIST_REMOVE(socket, next);
> + g_free(socket);
> + }
> +
> return 0;
> }
>
Reviewed-by: Maxim Levitsky <address@hidden>
Best regards,
Maxim Levitsky
- [Qemu-block] [PATCH v2 0/7] block/curl: Fix hang and potential crash, Max Reitz, 2019/09/10
- [Qemu-block] [PATCH v2 1/7] curl: Keep pointer to the CURLState in CURLSocket, Max Reitz, 2019/09/10
- [Qemu-block] [PATCH v2 2/7] curl: Keep *socket until the end of curl_sock_cb(), Max Reitz, 2019/09/10
- [Qemu-block] [PATCH v2 3/7] curl: Check completion in curl_multi_do(), Max Reitz, 2019/09/10
- [Qemu-block] [PATCH v2 4/7] curl: Pass CURLSocket to curl_multi_do(), Max Reitz, 2019/09/10
- [Qemu-block] [PATCH v2 5/7] curl: Report only ready sockets, Max Reitz, 2019/09/10
- [Qemu-block] [PATCH v2 6/7] curl: Handle success in multi_check_completion, Max Reitz, 2019/09/10