@@ -895,7 +895,7 @@ namespace net_utils
895
895
boost::uuids::random_generator ()(),
896
896
*real_remote,
897
897
is_income,
898
- connection_basic::m_ssl_support == ssl_support_t ::e_ssl_support_enabled
898
+ connection_basic::m_ssl_support
899
899
);
900
900
m_host = real_remote->host_str ();
901
901
try { host_count (1 ); } catch (...) { /* ignore */ }
@@ -1559,7 +1559,7 @@ namespace net_utils
1559
1559
}
1560
1560
// ---------------------------------------------------------------------------------
1561
1561
template <class t_protocol_handler >
1562
- typename boosted_tcp_server<t_protocol_handler>::try_connect_result_t boosted_tcp_server<t_protocol_handler>::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 )
1562
+ typename boosted_tcp_server<t_protocol_handler>::try_connect_result_t boosted_tcp_server<t_protocol_handler>::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_options_t & ssl_options )
1563
1563
{
1564
1564
TRY_ENTRY ();
1565
1565
@@ -1635,7 +1635,7 @@ namespace net_utils
1635
1635
{
1636
1636
// Handshake
1637
1637
MDEBUG (" Handshaking SSL..." );
1638
- if (!new_connection_l->handshake (boost::asio::ssl::stream_base::client ))
1638
+ if (!new_connection_l->client_handshake (ssl_options ))
1639
1639
{
1640
1640
if (ssl_support == epee::net_utils::ssl_support_t ::e_ssl_support_autodetect)
1641
1641
{
@@ -1649,6 +1649,7 @@ namespace net_utils
1649
1649
sock_.close ();
1650
1650
return CONNECT_FAILURE;
1651
1651
}
1652
+ new_connection_l->set_ssl_enabled ();
1652
1653
}
1653
1654
1654
1655
return CONNECT_SUCCESS;
@@ -1657,11 +1658,11 @@ namespace net_utils
1657
1658
}
1658
1659
// ---------------------------------------------------------------------------------
1659
1660
template <class t_protocol_handler >
1660
- bool boosted_tcp_server<t_protocol_handler>::connect(const std::string& adr, const std::string& port, uint32_t conn_timeout, t_connection_context& conn_context, const std::string& bind_ip, epee::net_utils::ssl_support_t ssl_support )
1661
+ bool boosted_tcp_server<t_protocol_handler>::connect(const std::string& adr, const std::string& port, uint32_t conn_timeout, t_connection_context& conn_context, const std::string& bind_ip, epee::net_utils::ssl_options_t ssl_options )
1661
1662
{
1662
1663
TRY_ENTRY ();
1663
1664
1664
- connection_ptr new_connection_l (new connection<t_protocol_handler>(io_service_, m_state, m_connection_type, ssl_support ) );
1665
+ connection_ptr new_connection_l (new connection<t_protocol_handler>(io_service_, m_state, m_connection_type, ssl_options. support ) );
1665
1666
connections_mutex.lock ();
1666
1667
connections_.insert (new_connection_l);
1667
1668
MDEBUG (" connections_ size now " << connections_.size ());
@@ -1746,15 +1747,16 @@ namespace net_utils
1746
1747
// boost::asio::ip::tcp::endpoint remote_endpoint(boost::asio::ip::address::from_string(addr.c_str()), port);
1747
1748
boost::asio::ip::tcp::endpoint remote_endpoint (*iterator);
1748
1749
1749
- auto try_connect_result = try_connect (new_connection_l, adr, port, sock_, remote_endpoint, bind_ip_to_use, conn_timeout, ssl_support );
1750
+ auto try_connect_result = try_connect (new_connection_l, adr, port, sock_, remote_endpoint, bind_ip_to_use, conn_timeout, ssl_options );
1750
1751
if (try_connect_result == CONNECT_FAILURE)
1751
1752
return false ;
1752
- if (ssl_support == epee::net_utils::ssl_support_t ::e_ssl_support_autodetect && try_connect_result == CONNECT_NO_SSL)
1753
+ if (ssl_options. support == epee::net_utils::ssl_support_t ::e_ssl_support_autodetect && try_connect_result == CONNECT_NO_SSL)
1753
1754
{
1754
1755
// we connected, but could not connect with SSL, try without
1755
1756
MERROR (" SSL handshake failed on an autodetect connection, reconnecting without SSL" );
1756
1757
new_connection_l->disable_ssl ();
1757
- try_connect_result = try_connect (new_connection_l, adr, port, sock_, remote_endpoint, bind_ip_to_use, conn_timeout, epee::net_utils::ssl_support_t ::e_ssl_support_disabled);
1758
+ ssl_options = epee::net_utils::ssl_support_t ::e_ssl_support_disabled;
1759
+ try_connect_result = try_connect (new_connection_l, adr, port, sock_, remote_endpoint, bind_ip_to_use, conn_timeout, ssl_options);
1758
1760
if (try_connect_result != CONNECT_SUCCESS)
1759
1761
return false ;
1760
1762
}
@@ -1783,10 +1785,10 @@ namespace net_utils
1783
1785
}
1784
1786
// ---------------------------------------------------------------------------------
1785
1787
template <class t_protocol_handler > template <class t_callback >
1786
- 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 )
1788
+ 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_options_t ssl_options )
1787
1789
{
1788
1790
TRY_ENTRY ();
1789
- connection_ptr new_connection_l (new connection<t_protocol_handler>(io_service_, m_state, m_connection_type, ssl_support ) );
1791
+ connection_ptr new_connection_l (new connection<t_protocol_handler>(io_service_, m_state, m_connection_type, ssl_options. support ) );
1790
1792
connections_mutex.lock ();
1791
1793
connections_.insert (new_connection_l);
1792
1794
MDEBUG (" connections_ size now " << connections_.size ());
0 commit comments