123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- #ifndef HEADER_CURL_CONNCACHE_H
- #define HEADER_CURL_CONNCACHE_H
- #include <curl/curl.h>
- #include "timeval.h"
- struct connectdata;
- struct Curl_easy;
- struct curl_pollfds;
- struct curl_waitfds;
- struct Curl_multi;
- struct Curl_share;
- typedef bool Curl_cpool_disconnect_cb(struct Curl_easy *data,
- struct connectdata *conn,
- bool aborted);
- struct cpool {
-
- struct Curl_hash dest2bundle;
- size_t num_conn;
- curl_off_t next_connection_id;
- curl_off_t next_easy_id;
- struct curltime last_cleanup;
- struct Curl_llist shutdowns;
- struct Curl_easy *idata;
- struct Curl_multi *multi;
- struct Curl_share *share;
- Curl_cpool_disconnect_cb *disconnect_cb;
- BIT(locked);
- };
- int Curl_cpool_init(struct cpool *cpool,
- Curl_cpool_disconnect_cb *disconnect_cb,
- struct Curl_multi *multi,
- struct Curl_share *share,
- size_t size);
- void Curl_cpool_destroy(struct cpool *connc);
- void Curl_cpool_xfer_init(struct Curl_easy *data);
- struct connectdata *Curl_cpool_get_conn(struct Curl_easy *data,
- curl_off_t conn_id);
- CURLcode Curl_cpool_add_conn(struct Curl_easy *data,
- struct connectdata *conn) WARN_UNUSED_RESULT;
- #define CPOOL_LIMIT_OK 0
- #define CPOOL_LIMIT_DEST 1
- #define CPOOL_LIMIT_TOTAL 2
- int Curl_cpool_check_limits(struct Curl_easy *data,
- struct connectdata *conn);
- typedef bool Curl_cpool_conn_match_cb(struct connectdata *conn,
- void *userdata);
- typedef bool Curl_cpool_done_match_cb(bool result, void *userdata);
- bool Curl_cpool_find(struct Curl_easy *data,
- const char *destination, size_t dest_len,
- Curl_cpool_conn_match_cb *conn_cb,
- Curl_cpool_done_match_cb *done_cb,
- void *userdata);
- bool Curl_cpool_conn_now_idle(struct Curl_easy *data,
- struct connectdata *conn);
- void Curl_cpool_disconnect(struct Curl_easy *data,
- struct connectdata *conn,
- bool aborted);
- void Curl_cpool_prune_dead(struct Curl_easy *data);
- CURLcode Curl_cpool_upkeep(void *data);
- typedef void Curl_cpool_conn_do_cb(struct connectdata *conn,
- struct Curl_easy *data,
- void *cbdata);
- void Curl_cpool_do_by_id(struct Curl_easy *data,
- curl_off_t conn_id,
- Curl_cpool_conn_do_cb *cb, void *cbdata);
- void Curl_cpool_do_locked(struct Curl_easy *data,
- struct connectdata *conn,
- Curl_cpool_conn_do_cb *cb, void *cbdata);
- CURLcode Curl_cpool_add_pollfds(struct cpool *connc,
- struct curl_pollfds *cpfds);
- CURLcode Curl_cpool_add_waitfds(struct cpool *connc,
- struct curl_waitfds *cwfds);
- void Curl_cpool_multi_perform(struct Curl_multi *multi);
- void Curl_cpool_multi_socket(struct Curl_multi *multi,
- curl_socket_t s, int ev_bitmask);
- #endif
|