Reuse TCP connection, still open can be used again. More...
#include <outside_network.h>
Data Fields | |
rbnode_type | node |
rbtree node with links in tcp_reuse tree. More... | |
struct sockaddr_storage | addr |
the key for the tcp_reuse tree. More... | |
socklen_t | addrlen |
length of addr | |
int | is_ssl |
also key for tcp_reuse tree, if ssl is used | |
struct reuse_tcp * | lru_next |
lru chain, so that the oldest can be removed to get a new connection when all are in (re)use. More... | |
struct reuse_tcp * | lru_prev |
int | item_on_lru_list |
true if the reuse_tcp item is on the lru list with empty items | |
struct pending_tcp * | pending |
the connection to reuse, the fd is non-1 and is open. More... | |
int | cp_more_read_again |
The more read again value pointed to by the commpoint tcp_more_read_again pointer, so that it exists after commpoint delete. | |
int | cp_more_write_again |
The more write again value pointed to by the commpoint tcp_more_write_again pointer, so that it exists after commpoint delete. | |
rbtree_type | tree_by_id |
rbtree with other queries waiting on the connection, by ID number, of type struct waiting_tcp. More... | |
struct waiting_tcp * | write_wait_first |
list of queries waiting to be written on the channel, if NULL no queries are waiting to be written and the pending->query is the query currently serviced. More... | |
struct waiting_tcp * | write_wait_last |
struct outside_network * | outnet |
the outside network it is part of | |
Reuse TCP connection, still open can be used again.
rbnode_type reuse_tcp::node |
rbtree node with links in tcp_reuse tree.
key is NULL when not in tree. Both active and empty connections are in the tree. key is a pointer to this structure, the members used to compare are the sockaddr and and then is-ssl bool, and then ptr value is used in case the same address exists several times in the tree when there are multiple connections to the same destination to make the rbtree items unique.
Referenced by decommission_pending_tcp(), outnet_tcp_cb(), reuse_tcp_find(), reuse_tcp_insert(), reuse_tcp_remove_serviced_keep(), reuse_tcp_remove_tree_list(), and reuse_tcp_select_id().
struct sockaddr_storage reuse_tcp::addr |
the key for the tcp_reuse tree.
address of peer, ip4 or ip6, and port number of peer
Referenced by log_reuse_tcp(), reuse_cmp_addrportssl(), reuse_tcp_find(), and reuse_tcp_remove_tree_list().
struct reuse_tcp* reuse_tcp::lru_next |
lru chain, so that the oldest can be removed to get a new connection when all are in (re)use.
oldest is last in list. The lru only contains empty connections waiting for reuse, the ones with active queries are not on the list because they do not need to be closed to make space for others. They already service a query so the close for another query does not help service a larger number of queries.
Referenced by check_removal(), check_tree_and_list(), reuse_tcp_insert(), reuse_tcp_lru_snip(), reuse_tcp_lru_touch(), and reuse_tcp_remove_tree_list().
struct pending_tcp* reuse_tcp::pending |
the connection to reuse, the fd is non-1 and is open.
the addr and port determine where the connection is going, and is key to the rbtree. The SSL ptr determines if it is a TLS connection or a plain TCP connection there. And TLS or not is also part of the key to the rbtree. There is a timeout and read event on the fd, to close it.
Referenced by log_reuse_tcp(), pending_tcp_query(), reuse_tcp_close_oldest(), reuse_tcp_find(), reuse_tcp_insert(), reuse_tcp_remove_tree_list(), tcpid_addmore(), and tcpid_test().
rbtree_type reuse_tcp::tree_by_id |
rbtree with other queries waiting on the connection, by ID number, of type struct waiting_tcp.
It is for looking up received answers to the structure for callback. And also to see if ID numbers are unused and can be used for a new query. The write_wait elements are also in the tree, so that ID numbers can be looked up also for them. They are bool write_wait_queued.
Referenced by decommission_pending_tcp(), outnet_tcp_cb(), reuse_cb_and_decommission(), reuse_tcp_by_id_find(), reuse_tcp_select_id(), reuse_tree_by_id_delete(), reuse_tree_by_id_insert(), tcpid_fillup(), and tcpid_test().
struct waiting_tcp* reuse_tcp::write_wait_first |
list of queries waiting to be written on the channel, if NULL no queries are waiting to be written and the pending->query is the query currently serviced.
The first is the next in line. They are also in the tree_by_id. Once written, the are removed from this list, but stay in the tree.
Referenced by decommission_pending_tcp(), outnet_tcp_cb(), reuse_cb_and_decommission(), reuse_write_wait_clear(), reuse_write_wait_pop(), reuse_write_wait_push_back(), and reuse_write_wait_remove().