peer connection: pass ioContext, logger

Change-Id: Ifb0a3a3a408d8ec7bd001c960315cf2e6d6ad0df
diff --git a/src/connectionmanager.cpp b/src/connectionmanager.cpp
index 94e009d..4ddc28e 100644
--- a/src/connectionmanager.cpp
+++ b/src/connectionmanager.cpp
@@ -545,6 +545,7 @@
         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 @@
     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 42bfbc0..c1bf14e 100644
--- a/src/peer_connection.cpp
+++ b/src/peer_connection.cpp
@@ -162,6 +162,7 @@
 
     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 @@
             /*.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 @@
             /*.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::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 143ca70..e92e249 100644
--- a/src/peer_connection.h
+++ b/src/peer_connection.h
@@ -94,11 +94,13 @@
 
     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);