bes Updated for version 3.20.10
|
#include <CurlHandlePool.h>
Public Member Functions | |
CurlHandlePool (unsigned int max_handles) | |
dmrpp_easy_handle * | get_easy_handle (Chunk *chunk) |
Add the given header & value to the curl slist. More... | |
unsigned int | get_handles_available () const |
unsigned int | get_max_handles () const |
Get the number of handles in the pool. More... | |
void | release_all_handles () |
void | release_handle (Chunk *chunk) |
Release the handle associated with a given chunk This is intended for use in error clean up code. More... | |
void | release_handle (dmrpp_easy_handle *h) |
Friends | |
class | Lock |
Get a CURL easy handle, assign a URL and other values, use the handler, return it to the pool. This class helps take advantage of libculr's built-in reuse capabilities (connection keep-alive, DNS pooling, etc.).
See https://ec.haxx.se/libcurl-connectionreuse.html for more information.
See d_max_easy_handles below for the limit on the total number of easy handles.
Definition at line 95 of file CurlHandlePool.h.
|
explicit |
Definition at line 346 of file CurlHandlePool.cc.
|
inline |
Definition at line 108 of file CurlHandlePool.h.
dmrpp_easy_handle * CurlHandlePool::get_easy_handle | ( | Chunk * | chunk | ) |
Add the given header & value to the curl slist.
The call must free the slist after the curl_easy_perform() is called, not after the headers are added to the curl handle.
slist | The list; initially pass nullptr to create a new list |
header | The header |
value | The value |
Definition at line 393 of file CurlHandlePool.cc.
|
inline |
Definition at line 119 of file CurlHandlePool.h.
|
inline |
Get the number of handles in the pool.
Definition at line 116 of file CurlHandlePool.h.
void CurlHandlePool::release_all_handles | ( | ) |
@breif release all outstanding curl handles If one access in a multi-transfer fails because of an error such as Access Denied, end the entire process and free all curl handles. This is different from an Internal Server Error response, which should be retried without ending the other accesses.
Definition at line 596 of file CurlHandlePool.cc.
void CurlHandlePool::release_handle | ( | Chunk * | chunk | ) |
Release the handle associated with a given chunk This is intended for use in error clean up code.
chunk | Find the handle for this chunk and release it. |
Definition at line 580 of file CurlHandlePool.cc.
void CurlHandlePool::release_handle | ( | dmrpp_easy_handle * | handle | ) |
Release a DMR++ easy_handle. This returns the handle to the pool of handles that can be used for serial transfers or, with multi curl, for parallel transfers.
handle |
Definition at line 545 of file CurlHandlePool.cc.
|
friend |
Definition at line 101 of file CurlHandlePool.h.