diff --git a/src/connectivity/connectionmanager.cpp b/src/connectivity/connectionmanager.cpp index 67aaef92b660bc7f5c162609ad5490e87823f8ba..65079a5c321b4df2cdf1c5963b23a24fae6cf441 100644 --- a/src/connectivity/connectionmanager.cpp +++ b/src/connectivity/connectionmanager.cpp @@ -397,6 +397,11 @@ ConnectionManager::Impl::connectDeviceOnNegoDone( return false; std::unique_lock<std::mutex> lk {info->mutex_}; + if (info->waitForAnswer_) { + // Negotiation is done and connected, go to handshake + // and avoid any cancellation at this point. + info->waitForAnswer_->cancel(); + } auto& ice = info->ice_; if (!ice || !ice->isRunning()) { JAMI_ERR("No ICE detected or not running"); diff --git a/src/connectivity/transport/peer_channel.h b/src/connectivity/transport/peer_channel.h index c47871310c978ba2f5482c56258d6f283829c63c..f86a5d3e3278635b50bc936b0d7c6654ad0c35ee 100644 --- a/src/connectivity/transport/peer_channel.h +++ b/src/connectivity/transport/peer_channel.h @@ -44,7 +44,7 @@ public: std::unique_lock<std::mutex> lk {mutex_}; cv_.wait_for(lk, timeout, [this] { return stop_ or not stream_.empty(); }); if (stop_) { - ec = std::make_error_code(std::errc::interrupted); + ec = std::make_error_code(std::errc::broken_pipe); return -1; } ec.clear();