diff --git a/src/connectionmanager.cpp b/src/connectionmanager.cpp index 94e009dc2cc600e0da6cd1f05923b3d845e3c3a3..4ddc28e3f82c76195418fe9d6455b57169cefb06 100644 --- a/src/connectionmanager.cpp +++ b/src/connectionmanager.cpp @@ -545,6 +545,7 @@ ConnectionManager::Impl::connectDeviceOnNegoDone( config_->logger->debug("Start TLS session - Initied by connectDevice(). Launched by channel: {} - device: {} - vid: {}", name, deviceId, vid); info->tls_ = std::make_unique<TlsSocketEndpoint>(std::move(endpoint), certStore(), + config_->ioContext, identity(), dhParams(), *cert); @@ -1052,6 +1053,7 @@ ConnectionManager::Impl::onRequestOnNegoDone(const PeerConnectionRequest& req) info->tls_ = std::make_unique<TlsSocketEndpoint>( std::move(endpoint), certStore(), + config_->ioContext, identity(), dhParams(), [ph, w = weak()](const dht::crypto::Certificate& cert) { diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index 42bfbc011e921bf204df3bcb912a128951602e11..c1bf14e96b6d4073db44f7e5ea73a6dea99ef839 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -162,6 +162,7 @@ public: Impl(std::unique_ptr<IceSocketEndpoint>&& ep, tls::CertificateStore& certStore, + const std::shared_ptr<asio::io_context>& ioContext, const dht::crypto::Certificate& peer_cert, const Identity& local_identity, const std::shared_future<tls::DhParams>& dh_params) @@ -188,12 +189,15 @@ public: /*.certStore = */ certStore, /*.timeout = */ TLS_TIMEOUT, /*.cert_check = */ nullptr, + /*.io_context = */ ioContext, + /* .logger = */ ep->underlyingICE()->logger() }; tls = std::make_unique<tls::TlsSession>(std::move(ep), tls_param, tls_cbs); } Impl(std::unique_ptr<IceSocketEndpoint>&& ep, tls::CertificateStore& certStore, + std::shared_ptr<asio::io_context> ioContext, std::function<bool(const dht::crypto::Certificate&)>&& cert_check, const Identity& local_identity, const std::shared_future<tls::DhParams>& dh_params) @@ -221,6 +225,8 @@ public: /*.certStore = */ certStore, /*.timeout = */ std::chrono::duration_cast<decltype(tls::TlsParams::timeout)>(TLS_TIMEOUT), /*.cert_check = */ nullptr, + /*.io_context = */ ioContext, + /* .logger = */ ep->underlyingICE()->logger() }; tls = std::make_unique<tls::TlsSession>(std::move(ep), tls_param, tls_cbs); } @@ -312,20 +318,22 @@ TlsSocketEndpoint::Impl::onTlsCertificatesUpdate([[maybe_unused]] const gnutls_d TlsSocketEndpoint::TlsSocketEndpoint(std::unique_ptr<IceSocketEndpoint>&& tr, tls::CertificateStore& certStore, + const std::shared_ptr<asio::io_context>& ioContext, const Identity& local_identity, const std::shared_future<tls::DhParams>& dh_params, const dht::crypto::Certificate& peer_cert) - : pimpl_ {std::make_unique<Impl>(std::move(tr), certStore, peer_cert, local_identity, dh_params)} + : pimpl_ {std::make_unique<Impl>(std::move(tr), certStore, ioContext, peer_cert, local_identity, dh_params)} {} TlsSocketEndpoint::TlsSocketEndpoint( std::unique_ptr<IceSocketEndpoint>&& tr, tls::CertificateStore& certStore, + const std::shared_ptr<asio::io_context>& ioContext, const Identity& local_identity, const std::shared_future<tls::DhParams>& dh_params, std::function<bool(const dht::crypto::Certificate&)>&& cert_check) : pimpl_ { - std::make_unique<Impl>(std::move(tr), certStore, std::move(cert_check), local_identity, dh_params)} + std::make_unique<Impl>(std::move(tr), certStore, ioContext, std::move(cert_check), local_identity, dh_params)} {} TlsSocketEndpoint::~TlsSocketEndpoint() {} diff --git a/src/peer_connection.h b/src/peer_connection.h index 143ca706141f9acda4b8d625f236c1476d14c1e5..e92e24986f096a111c0064f9744ec4b5d86dde85 100644 --- a/src/peer_connection.h +++ b/src/peer_connection.h @@ -94,11 +94,13 @@ public: TlsSocketEndpoint(std::unique_ptr<IceSocketEndpoint>&& tr, tls::CertificateStore& certStore, + const std::shared_ptr<asio::io_context>& ioContext, const Identity& local_identity, const std::shared_future<tls::DhParams>& dh_params, const dht::crypto::Certificate& peer_cert); TlsSocketEndpoint(std::unique_ptr<IceSocketEndpoint>&& tr, tls::CertificateStore& certStore, + const std::shared_ptr<asio::io_context>& ioContext, const Identity& local_identity, const std::shared_future<tls::DhParams>& dh_params, std::function<bool(const dht::crypto::Certificate&)>&& cert_check);