diff options
| author | Lee *!* Clagett <code@leeclagett.com> | 2025-06-20 20:45:30 -0400 |
|---|---|---|
| committer | Lee *!* Clagett <code@leeclagett.com> | 2025-08-19 17:16:05 -0400 |
| commit | e23b759b37027b989d1eee81f91cae9d28109f2b (patch) | |
| tree | d34edab68cfa89a7a6da3a76ab544ddad732c05e /contrib/epee | |
| parent | 2987b720069489cfc24d8d9ffc06ff017ffcb4d4 (diff) | |
| download | monzero-core-e23b759b37027b989d1eee81f91cae9d28109f2b.tar.gz monzero-core-e23b759b37027b989d1eee81f91cae9d28109f2b.tar.xz monzero-core-e23b759b37027b989d1eee81f91cae9d28109f2b.zip | |
Skip ping connections in outgoing count
Diffstat (limited to 'contrib/epee')
| -rw-r--r-- | contrib/epee/include/net/abstract_tcp_server2.h | 8 | ||||
| -rw-r--r-- | contrib/epee/include/net/abstract_tcp_server2.inl | 14 |
2 files changed, 14 insertions, 8 deletions
diff --git a/contrib/epee/include/net/abstract_tcp_server2.h b/contrib/epee/include/net/abstract_tcp_server2.h index 1e45e6809..a9d7fce11 100644 --- a/contrib/epee/include/net/abstract_tcp_server2.h +++ b/contrib/epee/include/net/abstract_tcp_server2.h @@ -288,13 +288,15 @@ namespace net_utils explicit connection( io_context_t& io_context, std::shared_ptr<shared_state> state, t_connection_type connection_type, - epee::net_utils::ssl_support_t ssl_support); + epee::net_utils::ssl_support_t ssl_support, + t_connection_context&& initial = t_connection_context{}); explicit connection( io_context_t& io_context, boost::asio::ip::tcp::socket&& sock, std::shared_ptr<shared_state> state, t_connection_type connection_type, - epee::net_utils::ssl_support_t ssl_support); + epee::net_utils::ssl_support_t ssl_support, + t_connection_context&& initial = t_connection_context{}); @@ -399,7 +401,7 @@ namespace net_utils try_connect_result_t try_connect(connection_ptr new_connection_l, const std::string& adr, const std::string& port, boost::asio::ip::tcp::socket &sock_, const boost::asio::ip::tcp::endpoint &remote_endpoint, const std::string &bind_ip, uint32_t conn_timeout, epee::net_utils::ssl_support_t ssl_support); bool connect(const std::string& adr, const std::string& port, uint32_t conn_timeot, t_connection_context& cn, const std::string& bind_ip = "0.0.0.0", epee::net_utils::ssl_support_t ssl_support = epee::net_utils::ssl_support_t::e_ssl_support_autodetect); template<class t_callback> - bool connect_async(const std::string& adr, const std::string& port, uint32_t conn_timeot, const t_callback &cb, const std::string& bind_ip = "0.0.0.0", epee::net_utils::ssl_support_t ssl_support = epee::net_utils::ssl_support_t::e_ssl_support_autodetect); + bool connect_async(const std::string& adr, const std::string& port, uint32_t conn_timeot, const t_callback &cb, const std::string& bind_ip = "0.0.0.0", epee::net_utils::ssl_support_t ssl_support = epee::net_utils::ssl_support_t::e_ssl_support_autodetect, t_connection_context&& initial = t_connection_context{}); boost::asio::ssl::context& get_ssl_context() noexcept { diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl index bc1f801a4..05d7240fb 100644 --- a/contrib/epee/include/net/abstract_tcp_server2.inl +++ b/contrib/epee/include/net/abstract_tcp_server2.inl @@ -973,14 +973,16 @@ namespace net_utils io_context_t &io_context, std::shared_ptr<shared_state> shared_state, t_connection_type connection_type, - ssl_support_t ssl_support + ssl_support_t ssl_support, + t_connection_context&& initial ): connection( io_context, socket_t{io_context}, std::move(shared_state), connection_type, - ssl_support + ssl_support, + std::move(initial) ) { } @@ -991,12 +993,14 @@ namespace net_utils socket_t &&socket, std::shared_ptr<shared_state> shared_state, t_connection_type connection_type, - ssl_support_t ssl_support + ssl_support_t ssl_support, + t_connection_context&& initial ): connection_basic(io_context, std::move(socket), shared_state, ssl_support), m_handler(this, *shared_state, m_conn_context), m_connection_type(connection_type), m_io_context{io_context}, + m_conn_context(std::move(initial)), m_strand{m_io_context}, m_timers{m_io_context} { @@ -1848,10 +1852,10 @@ namespace net_utils } //--------------------------------------------------------------------------------- template<class t_protocol_handler> template<class t_callback> - bool boosted_tcp_server<t_protocol_handler>::connect_async(const std::string& adr, const std::string& port, uint32_t conn_timeout, const t_callback &cb, const std::string& bind_ip, epee::net_utils::ssl_support_t ssl_support) + bool boosted_tcp_server<t_protocol_handler>::connect_async(const std::string& adr, const std::string& port, uint32_t conn_timeout, const t_callback &cb, const std::string& bind_ip, epee::net_utils::ssl_support_t ssl_support, t_connection_context&& initial) { TRY_ENTRY(); - connection_ptr new_connection_l(new connection<t_protocol_handler>(io_context_, m_state, m_connection_type, ssl_support) ); + connection_ptr new_connection_l(new connection<t_protocol_handler>(io_context_, m_state, m_connection_type, ssl_support, std::move(initial)) ); connections_mutex.lock(); connections_.insert(new_connection_l); MDEBUG("connections_ size now " << connections_.size()); |
