diff options
author | dartraiden <wowemuh@gmail.com> | 2021-02-07 18:49:47 +0300 |
---|---|---|
committer | dartraiden <wowemuh@gmail.com> | 2021-02-07 18:49:47 +0300 |
commit | 2f0eaffffe7e5d3ac074797f880480494dbcc6f3 (patch) | |
tree | 161fa6a6df8387d618530a684de9f61f58640596 /libs/libcurl/src/conncache.h | |
parent | 061f5621d3f64835c376a7781af86a5e5ee1145c (diff) |
libcurl: update to 7.75.0
Diffstat (limited to 'libs/libcurl/src/conncache.h')
-rw-r--r-- | libs/libcurl/src/conncache.h | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/libs/libcurl/src/conncache.h b/libs/libcurl/src/conncache.h index ac5460ff4b..e9c1e32f87 100644 --- a/libs/libcurl/src/conncache.h +++ b/libs/libcurl/src/conncache.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2015 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 2015 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 2012 - 2014, Linus Nielsen Feltzing, <linus@haxx.se> * * This software is licensed as described in the file COPYING, which @@ -29,6 +29,10 @@ * be shared. */ +#include "timeval.h" + +struct connectdata; + struct conncache { struct Curl_hash hash; size_t num_conn; @@ -45,17 +49,24 @@ struct conncache { #ifdef CURLDEBUG /* the debug versions of these macros make extra certain that the lock is never doubly locked or unlocked */ -#define CONNCACHE_LOCK(x) if((x)->share) { \ - Curl_share_lock((x), CURL_LOCK_DATA_CONNECT, CURL_LOCK_ACCESS_SINGLE); \ - DEBUGASSERT(!(x)->state.conncache_lock); \ - (x)->state.conncache_lock = TRUE; \ - } +#define CONNCACHE_LOCK(x) \ + do { \ + if((x)->share) { \ + Curl_share_lock((x), CURL_LOCK_DATA_CONNECT, \ + CURL_LOCK_ACCESS_SINGLE); \ + DEBUGASSERT(!(x)->state.conncache_lock); \ + (x)->state.conncache_lock = TRUE; \ + } \ + } while(0) -#define CONNCACHE_UNLOCK(x) if((x)->share) { \ - DEBUGASSERT((x)->state.conncache_lock); \ - (x)->state.conncache_lock = FALSE; \ - Curl_share_unlock((x), CURL_LOCK_DATA_CONNECT); \ - } +#define CONNCACHE_UNLOCK(x) \ + do { \ + if((x)->share) { \ + DEBUGASSERT((x)->state.conncache_lock); \ + (x)->state.conncache_lock = FALSE; \ + Curl_share_unlock((x), CURL_LOCK_DATA_CONNECT); \ + } \ + } while(0) #else #define CONNCACHE_LOCK(x) if((x)->share) \ Curl_share_lock((x), CURL_LOCK_DATA_CONNECT, CURL_LOCK_ACCESS_SINGLE) @@ -74,7 +85,8 @@ int Curl_conncache_init(struct conncache *, int size); void Curl_conncache_destroy(struct conncache *connc); /* return the correct bundle, to a host or a proxy */ -struct connectbundle *Curl_conncache_find_bundle(struct connectdata *conn, +struct connectbundle *Curl_conncache_find_bundle(struct Curl_easy *data, + struct connectdata *conn, struct conncache *connc, const char **hostp); /* returns number of connections currently held in the connection cache */ @@ -82,15 +94,15 @@ size_t Curl_conncache_size(struct Curl_easy *data); bool Curl_conncache_return_conn(struct Curl_easy *data, struct connectdata *conn); -CURLcode Curl_conncache_add_conn(struct conncache *connc, - struct connectdata *conn) WARN_UNUSED_RESULT; +CURLcode Curl_conncache_add_conn(struct Curl_easy *data) WARN_UNUSED_RESULT; void Curl_conncache_remove_conn(struct Curl_easy *data, struct connectdata *conn, bool lock); bool Curl_conncache_foreach(struct Curl_easy *data, struct conncache *connc, void *param, - int (*func)(struct connectdata *conn, + int (*func)(struct Curl_easy *data, + struct connectdata *conn, void *param)); struct connectdata * |