Blame SOURCES/kvm-curl-Keep-pointer-to-the-CURLState-in-CURLSocket.patch

016a62
From 21dbedae8100710d284b79f7ce21a6b095a4c6e0 Mon Sep 17 00:00:00 2001
016a62
From: Max Reitz <mreitz@redhat.com>
016a62
Date: Tue, 19 Nov 2019 15:29:54 +0000
016a62
Subject: [PATCH 2/8] curl: Keep pointer to the CURLState in CURLSocket
016a62
MIME-Version: 1.0
016a62
Content-Type: text/plain; charset=UTF-8
016a62
Content-Transfer-Encoding: 8bit
016a62
016a62
RH-Author: Max Reitz <mreitz@redhat.com>
016a62
Message-id: <20191119153000.101646-2-mreitz@redhat.com>
016a62
Patchwork-id: 92515
016a62
O-Subject: [RHEL-8.2.0 qemu-kvm PATCH 1/7] curl: Keep pointer to the CURLState in CURLSocket
016a62
Bugzilla: 1744602
016a62
RH-Acked-by: Maxim Levitsky <mlevitsk@redhat.com>
016a62
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
016a62
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
016a62
016a62
A follow-up patch will make curl_multi_do() and curl_multi_read() take a
016a62
CURLSocket instead of the CURLState.  They still need the latter,
016a62
though, so add a pointer to it to the former.
016a62
016a62
Cc: qemu-stable@nongnu.org
016a62
Signed-off-by: Max Reitz <mreitz@redhat.com>
016a62
Reviewed-by: John Snow <jsnow@redhat.com>
016a62
Message-id: 20190910124136.10565-2-mreitz@redhat.com
016a62
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
016a62
Signed-off-by: Max Reitz <mreitz@redhat.com>
016a62
(cherry picked from commit 0487861685294660b23bc146e1ebd5304aa8bbe0)
016a62
Signed-off-by: Max Reitz <mreitz@redhat.com>
016a62
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
016a62
---
016a62
 block/curl.c | 3 +++
016a62
 1 file changed, 3 insertions(+)
016a62
016a62
diff --git a/block/curl.c b/block/curl.c
016a62
index f0df33a..fa602d1 100644
016a62
--- a/block/curl.c
016a62
+++ b/block/curl.c
016a62
@@ -89,6 +89,7 @@ static CURLMcode __curl_multi_socket_action(CURLM *multi_handle,
016a62
 #define CURL_BLOCK_OPT_PROXY_PASSWORD_SECRET "proxy-password-secret"
016a62
 
016a62
 struct BDRVCURLState;
016a62
+struct CURLState;
016a62
 
016a62
 static bool libcurl_initialized;
016a62
 
016a62
@@ -106,6 +107,7 @@ typedef struct CURLAIOCB {
016a62
 
016a62
 typedef struct CURLSocket {
016a62
     int fd;
016a62
+    struct CURLState *state;
016a62
     QLIST_ENTRY(CURLSocket) next;
016a62
 } CURLSocket;
016a62
 
016a62
@@ -189,6 +191,7 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
016a62
     if (!socket) {
016a62
         socket = g_new0(CURLSocket, 1);
016a62
         socket->fd = fd;
016a62
+        socket->state = state;
016a62
         QLIST_INSERT_HEAD(&state->sockets, socket, next);
016a62
     }
016a62
     socket = NULL;
016a62
-- 
016a62
1.8.3.1
016a62