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

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