#include "setup.h"#include <stdlib.h>#include <string.h>#include <curl/curl.h>#include "urldata.h"#include "transfer.h"#include "url.h"#include "connect.h"#include "progress.h"#include "memory.h"#include "easyif.h"#include "multiif.h"#include "sendf.h"#include "timeval.h"#include "http.h"#include "memdebug.h"Go to the source code of this file.
| #define CURL_MULTI_HANDLE 0x000bab1e |
| #define CURL_SOCKET_HASH_TABLE_SIZE 911 |
| #define GOOD_EASY_HANDLE | ( | x | ) | (((struct SessionHandle *)(x))->magic == CURLEASY_MAGIC_NUMBER) |
Definition at line 134 of file multi.c.
Referenced by curl_multi_add_handle(), curl_multi_remove_handle(), and multi_runsingle().
| #define GOOD_MULTI_HANDLE | ( | x | ) | ((x)&&(((struct Curl_multi *)(x))->type == CURL_MULTI_HANDLE)) |
Definition at line 132 of file multi.c.
Referenced by curl_multi_add_handle(), curl_multi_cleanup(), curl_multi_fdset(), curl_multi_info_read(), curl_multi_perform(), curl_multi_remove_handle(), curl_multi_setopt(), and curl_multi_timeout().
| #define MAX_SOCKSPEREASYHANDLE 5 |
| enum CURLMstate |
| static void add_closure | ( | struct Curl_multi * | multi, | |
| struct SessionHandle * | data | |||
| ) | [static] |
Definition at line 2073 of file multi.c.
References calloc, Curl_multi::closure, Curl_multi::connc, conncache::connects, Curl_close(), connectdata::data, closure::easy_handle, FALSE, free, infof, n, closure::next, NULL, conncache::num, UrlState::shared_conn, SessionHandle::state, and TRUE.
Referenced by curl_multi_remove_handle().
| void Curl_expire | ( | struct SessionHandle * | data, | |
| long | milli | |||
| ) |
Definition at line 1962 of file multi.c.
References Curl_splayinsert(), Curl_splayprint, Curl_splayremovebyaddr(), Curl_tvnow, curlx_tvdiff(), UrlState::expiretime, infof, SessionHandle::multi, Curl_tree::payload, SessionHandle::state, UrlState::timenode, Curl_multi::timetree, TRUE, timeval::tv_sec, and timeval::tv_usec.
Referenced by Curl_connecthost(), Curl_disconnect(), Curl_done(), Curl_is_connected(), curl_multi_add_handle(), curl_multi_remove_handle(), Curl_speedcheck(), and multi_runsingle().
Definition at line 397 of file multi.c.
References calloc, Curl_multi::closure, Curl_multi::connc, UrlState::connc, Curl_ch_connc(), Curl_easy_addmulti(), Curl_expire(), Curl_hash_destroy(), Curl_rm_connc(), CURLE_OK, CURLM_BAD_EASY_HANDLE, CURLM_BAD_HANDLE, CURLM_OK, CURLM_OUT_OF_MEMORY, CURLM_STATE_INIT, SessionHandle::dns, Curl_multi::easy, Curl_one_easy::easy_handle, closure::easy_handle, free, GOOD_EASY_HANDLE, GOOD_MULTI_HANDLE, Curl_multi::hostcache, Names::hostcache, Names::hostcachetype, Curl_multi::maxconnects, SessionHandle::multi_pos, multistate(), Curl_one_easy::next, closure::next, NULL, conncache::num, Curl_multi::num_alive, Curl_multi::num_easy, UserDefined::one_easy, Curl_one_easy::prev, SessionHandle::set, SessionHandle::state, conncache::type, and update_timer().
| CURLMcode curl_multi_assign | ( | CURLM * | multi_handle, | |
| curl_socket_t | s, | |||
| void * | hashp | |||
| ) |
Definition at line 2036 of file multi.c.
References Curl_hash_pick(), CURL_SOCKET_BAD, CURLM_BAD_SOCKET, CURLM_OK, NULL, Curl_sh_entry::socketp, and Curl_multi::sockhash.
| bool Curl_multi_canPipeline | ( | struct Curl_multi * | multi | ) |
Definition at line 693 of file multi.c.
References Curl_multi::pipelining_enabled.
Referenced by CreateConnection(), Curl_read(), IsPipeliningEnabled(), and IsPipeliningPossible().
Definition at line 1521 of file multi.c.
References UrlState::closed, Curl_multi::closure, UrlState::connc, Curl_multi::connc, conncache::connects, Curl_close(), Curl_disconnect(), Curl_easy_addmulti(), Curl_hash_destroy(), Curl_rm_connc(), CURLM_BAD_HANDLE, CURLM_OK, SessionHandle::dns, Curl_multi::easy, Curl_one_easy::easy_handle, closure::easy_handle, free, GOOD_MULTI_HANDLE, Names::hostcache, Curl_multi::hostcache, Names::hostcachetype, Curl_one_easy::msg, n, Curl_one_easy::next, closure::next, NULL, conncache::num, PROT_CLOSEACTION, connectdata::protocol, UrlState::shared_conn, Curl_multi::sockhash, SessionHandle::state, and Curl_multi::type.
| CURLMcode curl_multi_fdset | ( | CURLM * | multi_handle, | |
| fd_set * | read_fd_set, | |||
| fd_set * | write_fd_set, | |||
| fd_set * | exc_fd_set, | |||
| int * | max_fd | |||
| ) |
Definition at line 786 of file multi.c.
References CURL_SOCKET_BAD, CURLM_BAD_HANDLE, CURLM_OK, Curl_multi::easy, GETSOCK_READSOCK, GETSOCK_WRITESOCK, GOOD_MULTI_HANDLE, MAX_SOCKSPEREASYHANDLE, multi_getsock(), Curl_one_easy::next, and simple_client::s.
| void Curl_multi_handlePipeBreak | ( | struct SessionHandle * | data | ) |
Definition at line 698 of file multi.c.
References Curl_one_easy::easy_conn, NULL, UserDefined::one_easy, and SessionHandle::set.
Referenced by signalPipeClose().
Definition at line 1588 of file multi.c.
References Curl_multi::easy, Curl_message::extmsg, GOOD_MULTI_HANDLE, Curl_one_easy::msg, Curl_one_easy::msg_num, Curl_one_easy::next, NULL, and Curl_multi::num_msgs.
| CURLM* curl_multi_init | ( | void | ) |
Definition at line 356 of file multi.c.
References calloc, Curl_multi::connc, Curl_hash_destroy(), Curl_mk_connc(), Curl_mk_dnscache(), CURL_MULTI_HANDLE, Curl_multi::easy, free, Curl_multi::hostcache, Curl_one_easy::next, NULL, Curl_one_easy::prev, sh_init(), Curl_multi::sockhash, and Curl_multi::type.
Definition at line 1454 of file multi.c.
References UrlState::cancelled, Curl_multi_rmeasy(), Curl_splaygetbest(), Curl_tvnow, CURLM_BAD_HANDLE, CURLM_OK, CURLM_STATE_CANCELLED, Curl_multi::easy, Curl_one_easy::easy_handle, UrlState::expiretime, GOOD_MULTI_HANDLE, multi_runsingle(), Curl_one_easy::next, NULL, Curl_multi::num_alive, Curl_tree::payload, Curl_one_easy::state, SessionHandle::state, Curl_multi::timetree, timeval::tv_sec, timeval::tv_usec, and update_timer().
Referenced by multi_socket().
Definition at line 552 of file multi.c.
References add_closure(), UrlState::cancelled, UrlState::connc, connectdata::connectindex, Curl_done(), Curl_easy_addmulti(), Curl_expire(), CURLM_BAD_EASY_HANDLE, CURLM_BAD_HANDLE, CURLM_OK, CURLM_STATE_COMPLETED, CURLM_STATE_DO, connectdata::data, SessionHandle::dns, Curl_one_easy::easy_conn, Curl_one_easy::easy_handle, free, GOOD_EASY_HANDLE, GOOD_MULTI_HANDLE, Names::hostcache, Names::hostcachetype, UrlState::is_in_pipeline, Curl_one_easy::msg, multi_conn_using(), SessionHandle::multi_pos, Curl_one_easy::next, NULL, Curl_multi::num_alive, Curl_multi::num_easy, UserDefined::one_easy, Curl_one_easy::prev, connectdata::recv_pipe, Curl_one_easy::result, connectdata::send_pipe, SessionHandle::set, UrlState::shared_conn, singlesocket(), curl_llist::size, SessionHandle::state, Curl_one_easy::state, TRUE, conncache::type, and update_timer().
Referenced by Curl_multi_rmeasy().
| void Curl_multi_rmeasy | ( | void * | multi_handle, | |
| CURL * | easy_handle | |||
| ) |
Definition at line 1515 of file multi.c.
References curl_multi_remove_handle().
Referenced by Curl_close(), and curl_multi_perform().
| CURLMcode curl_multi_setopt | ( | CURLM * | multi_handle, | |
| CURLMoption | option, | |||
| ... | ||||
| ) |
Definition at line 1827 of file multi.c.
References CURLM_BAD_HANDLE, CURLM_OK, CURLM_UNKNOWN_OPTION, GOOD_MULTI_HANDLE, Curl_multi::maxconnects, Curl_multi::pipelining_enabled, Curl_multi::socket_cb, Curl_multi::socket_userp, Curl_multi::timer_cb, and Curl_multi::timer_userp.
| CURLMcode curl_multi_socket | ( | CURLM * | multi_handle, | |
| curl_socket_t | s, | |||
| int * | running_handles | |||
| ) |
Definition at line 1869 of file multi.c.
References CURLM_OK, FALSE, multi_socket(), and update_timer().
| CURLMcode curl_multi_socket_action | ( | CURLM * | multi_handle, | |
| curl_socket_t | s, | |||
| int | ev_bitmask, | |||
| int * | running_handles | |||
| ) |
Definition at line 1879 of file multi.c.
References CURLM_OK, FALSE, multi_socket(), and update_timer().
Definition at line 1889 of file multi.c.
References CURL_SOCKET_BAD, CURLM_OK, multi_socket(), TRUE, and update_timer().
Definition at line 1922 of file multi.c.
References CURLM_BAD_HANDLE, GOOD_MULTI_HANDLE, and multi_timeout().
| static int domore_getsock | ( | struct connectdata * | conn, | |
| curl_socket_t * | sock, | |||
| int | numsocks | |||
| ) | [static] |
Definition at line 717 of file multi.c.
References GETSOCK_BLANK, GETSOCK_WRITESOCK, SECONDARYSOCKET, and connectdata::sock.
Referenced by multi_getsock().
| static size_t fd_key_compare | ( | void * | k1, | |
| size_t | k1_len, | |||
| void * | k2, | |||
| size_t | k2_len | |||
| ) | [static] |
| static size_t hash_fd | ( | void * | key, | |
| size_t | key_length, | |||
| size_t | slots_num | |||
| ) | [static] |
| static bool multi_conn_using | ( | struct Curl_multi * | multi, | |
| struct SessionHandle * | data | |||
| ) | [static] |
Definition at line 2053 of file multi.c.
References Curl_multi::connc, conncache::connects, connectdata::data, FALSE, conncache::num, PROT_CLOSEACTION, connectdata::protocol, and TRUE.
Referenced by curl_multi_remove_handle().
| static int multi_getsock | ( | struct Curl_one_easy * | easy, | |
| curl_socket_t * | socks, | |||
| int | numsocks | |||
| ) | [static] |
Definition at line 735 of file multi.c.
References Curl_doing_getsock(), Curl_protocol_getsock(), Curl_resolv_getsock(), Curl_single_getsock(), CURLM_STATE_COMPLETED, CURLM_STATE_CONNECT, CURLM_STATE_DO_MORE, CURLM_STATE_DOING, CURLM_STATE_PERFORM, CURLM_STATE_PROTOCONNECT, CURLM_STATE_TOOFAST, CURLM_STATE_WAITCONNECT, CURLM_STATE_WAITPERFORM, CURLM_STATE_WAITRESOLVE, connectdata::data, domore_getsock(), Curl_one_easy::easy_conn, Curl_one_easy::easy_handle, UrlState::pipe_broke, Curl_one_easy::state, SessionHandle::state, and waitconnect_getsock().
Referenced by curl_multi_fdset(), and singlesocket().
| static CURLMcode multi_runsingle | ( | struct Curl_multi * | multi, | |
| struct Curl_one_easy * | easy | |||
| ) | [static] |
Definition at line 836 of file multi.c.
References connectdata::bits, UrlState::cancelled, SessionHandle::change, ConnectBits::close, UserDefined::connect_only, connectdata::connectindex, Curl_addHandleToPipeline(), Curl_async_resolved(), Curl_connect(), Curl_disconnect(), Curl_do(), Curl_do_more(), Curl_done(), Curl_expire(), Curl_follow(), Curl_http_connect(), Curl_is_connected(), Curl_is_resolved(), Curl_isHandleAtHead(), Curl_pgrsTime(), Curl_pgrsUpdate(), Curl_posttransfer(), Curl_pre_readwrite(), Curl_pretransfer(), Curl_protocol_connect(), Curl_protocol_connecting(), Curl_protocol_doing(), Curl_readwrite(), Curl_readwrite_init(), Curl_removeHandleFromPipeline(), Curl_retry_request(), CURL_SOCKET_BAD, CURLE_COULDNT_CONNECT, CURLE_OK, CURLE_OUT_OF_MEMORY, CURLM_BAD_EASY_HANDLE, CURLM_CALL_MULTI_PERFORM, CURLM_INTERNAL_ERROR, CURLM_OK, CURLM_OUT_OF_MEMORY, CURLM_STATE_CANCELLED, CURLM_STATE_COMPLETED, CURLM_STATE_CONNECT, CURLM_STATE_DO, CURLM_STATE_DO_DONE, CURLM_STATE_DO_MORE, CURLM_STATE_DOING, CURLM_STATE_DONE, CURLM_STATE_INIT, CURLM_STATE_PERFORM, CURLM_STATE_PROTOCONNECT, CURLM_STATE_TOOFAST, CURLM_STATE_WAITCONNECT, CURLM_STATE_WAITDO, CURLM_STATE_WAITPERFORM, CURLM_STATE_WAITPROXYCONNECT, CURLM_STATE_WAITRESOLVE, CURLMSG_DONE, CURLMsg::data, connectdata::data, Progress::dlspeed, SessionHandle::dns, ConnectBits::do_more, Curl_one_easy::easy_conn, CURLMsg::easy_handle, Curl_one_easy::easy_handle, Curl_message::extmsg, FALSE, FIRSTSOCKET, free, GOOD_EASY_HANDLE, Names::hostcache, Names::hostcachetype, infof, UrlState::is_in_pipeline, HandleData::keep, KEEP_READ, KEEP_WRITE, Curl_transfer_keeper::keepon, malloc, UserDefined::max_recv_speed, UserDefined::max_send_speed, CURLMsg::msg, Curl_one_easy::msg, Curl_one_easy::msg_num, multistate(), HandleData::newurl, Curl_message::next, NULL, Curl_multi::num_msgs, HandleData::path, UrlState::pipe_broke, SessionHandle::progress, connectdata::readchannel_inuse, connectdata::recv_pipe, SessionHandle::reqdata, CURLMsg::result, Curl_one_easy::result, sclose, SECONDARYSOCKET, connectdata::send_pipe, SessionHandle::set, curl_llist::size, connectdata::sock, state(), Curl_one_easy::state, SessionHandle::state, strdup, ConnectBits::stream_was_rewound, TIMER_STARTSINGLE, TRUE, ConnectBits::tunnel_connecting, Progress::ulspeed, DynamicStatic::url, DynamicStatic::url_changed, UrlState::used_interface, and connectdata::writechannel_inuse.
Referenced by curl_multi_perform(), and multi_socket().
| static CURLMcode multi_socket | ( | struct Curl_multi * | multi, | |
| bool | checkall, | |||
| curl_socket_t | s, | |||
| int | ev_bitmask, | |||
| int * | running_handles | |||
| ) | [static] |
Definition at line 1723 of file multi.c.
References connectdata::cselect_bits, Curl_hash_pick(), curl_multi_perform(), CURL_SOCKET_TIMEOUT, Curl_splaygetbest(), Curl_tvnow, CURLEASY_MAGIC_NUMBER, CURLM_BAD_SOCKET, CURLM_INTERNAL_ERROR, CURLM_OK, Curl_sh_entry::easy, Curl_multi::easy, Curl_one_easy::easy_conn, UrlState::expiretime, SessionHandle::magic, multi_runsingle(), Curl_one_easy::next, NULL, Curl_multi::num_alive, UserDefined::one_easy, Curl_tree::payload, SessionHandle::set, singlesocket(), Curl_multi::sockhash, SessionHandle::state, Curl_multi::timetree, timeval::tv_sec, and timeval::tv_usec.
Referenced by curl_multi_socket(), curl_multi_socket_action(), and curl_multi_socket_all().
| static CURLMcode multi_timeout | ( | struct Curl_multi * | multi, | |
| long * | timeout_ms | |||
| ) | [static] |
Definition at line 1899 of file multi.c.
References Curl_splay(), Curl_tvnow, CURLM_OK, Curl_tree::key, Curl_multi::timetree, timeval::tv_sec, and timeval::tv_usec.
Referenced by curl_multi_timeout(), and update_timer().
| static void multistate | ( | struct Curl_one_easy * | easy, | |
| CURLMstate | state | |||
| ) | [static] |
Definition at line 218 of file multi.c.
References connectdata::connectindex, CURLM_STATE_COMPLETED, CURLM_STATE_CONNECT, Curl_one_easy::easy_conn, Curl_one_easy::easy_handle, index, infof, and Curl_one_easy::state.
Referenced by curl_multi_add_handle(), and multi_runsingle().
| static struct Curl_sh_entry* sh_addentry | ( | struct curl_hash * | sh, | |
| curl_socket_t | s, | |||
| struct SessionHandle * | data | |||
| ) | [static, read] |
Definition at line 264 of file multi.c.
References calloc, Curl_hash_add(), Curl_hash_pick(), Curl_sh_entry::easy, free, NULL, and Curl_sh_entry::socket.
Referenced by singlesocket().
| static void sh_delentry | ( | struct curl_hash * | sh, | |
| curl_socket_t | s | |||
| ) | [static] |
Definition at line 294 of file multi.c.
References Curl_hash_delete(), and Curl_hash_pick().
Referenced by singlesocket().
| static void sh_freeentry | ( | void * | freethis | ) | [static] |
| static struct curl_hash* sh_init | ( | void | ) | [static, read] |
Definition at line 350 of file multi.c.
References Curl_hash_alloc(), CURL_SOCKET_HASH_TABLE_SIZE, fd_key_compare(), hash_fd(), and sh_freeentry().
Referenced by curl_multi_init().
| static void singlesocket | ( | struct Curl_multi * | multi, | |
| struct Curl_one_easy * | easy | |||
| ) | [static] |
Definition at line 1625 of file multi.c.
References Curl_sh_entry::action, Curl_hash_pick(), CURL_POLL_IN, CURL_POLL_NONE, CURL_POLL_OUT, CURL_POLL_REMOVE, CURL_SOCKET_BAD, Curl_one_easy::easy_handle, GETSOCK_READSOCK, GETSOCK_WRITESOCK, MAX_SOCKSPEREASYHANDLE, multi_getsock(), NULL, Curl_one_easy::numsocks, simple_client::s, sh_addentry(), sh_delentry(), Curl_multi::socket_cb, Curl_multi::socket_userp, Curl_sh_entry::socketp, Curl_one_easy::sockets, and Curl_multi::sockhash.
Referenced by curl_multi_remove_handle(), and multi_socket().
| static int update_timer | ( | struct Curl_multi * | multi | ) | [static] |
Definition at line 1938 of file multi.c.
References CURLM_OK, Curl_tree::key, multi_timeout(), Curl_multi::timer_cb, Curl_multi::timer_lastcall, Curl_multi::timer_userp, and Curl_multi::timetree.
Referenced by curl_multi_add_handle(), curl_multi_perform(), curl_multi_remove_handle(), curl_multi_socket(), curl_multi_socket_action(), and curl_multi_socket_all().
| static int waitconnect_getsock | ( | struct connectdata * | conn, | |
| curl_socket_t * | sock, | |||
| int | numsocks | |||
| ) | [static] |
Definition at line 706 of file multi.c.
References FIRSTSOCKET, GETSOCK_BLANK, GETSOCK_WRITESOCK, and connectdata::sock.
Referenced by multi_getsock().
1.5.6