curl: Introduce concept of getting/putting handles from a common pool
commit38dccd848bd40cccdf012df7a606e13282aaeecb
authorRichard W.M. Jones <rjones@redhat.com>
Sat, 4 Feb 2023 10:22:30 +0000 (4 10:22 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Tue, 7 Feb 2023 21:11:32 +0000 (7 21:11 +0000)
tree7c343d0c23773bd1f0265f91e847833efe383b88
parentebf1ad8568b688c58c931f282db60afc2ccb981f
curl: Introduce concept of getting/putting handles from a common pool

Introduce the concept of a pool of curl handles from which the main
code has to take a handle (get_handle()), and later return it to the
pool (put_handle()).  When a handle is taken from the pool it can be
used exclusively by the main code until it is returned.

The "pool" only has at most one handle, so this is actually a
pessimization from the situation before because all NBD connections
share a single curl handle.  In a future commit we will add support
for multiple handles in the pool.

A note about the change to tests/test-retry-request-mirror.c: This
test depended implicitly on a new NBD connection opening a new libcurl
handle (this no longer happens), and when opening a new libcurl handle
that causes a HEAD request to be made.  We have to adjust the test to
remove this assumption.
plugins/curl/Makefile.am
plugins/curl/curl.c
plugins/curl/curldefs.h
plugins/curl/pool.c [new file with mode: 0644]
plugins/curl/scripts.c
tests/test-retry-request-mirror.c