diff --git a/include/multiplexed_socket.h b/include/multiplexed_socket.h
index d8e6e163873a3afb9bc2808e6f9d4ba046067649..9e254bb61372b077ca226e9e1897d364c8a2b8a0 100644
--- a/include/multiplexed_socket.h
+++ b/include/multiplexed_socket.h
@@ -48,7 +48,7 @@ using OnConnectionRequestCb
                          const std::string& /* name */)>;
 using OnConnectionReadyCb
     = std::function<void(const DeviceId& /* deviceId */, const std::shared_ptr<ChannelSocket>&)>;
-using ChannelReadyCb = std::function<void(void)>;
+using ChannelReadyCb = std::function<void(bool)>;
 using OnShutdownCb = std::function<void(void)>;
 
 static constexpr auto SEND_BEACON_TIMEOUT = std::chrono::milliseconds(3000);
@@ -298,7 +298,7 @@ public:
      */
     void shutdown() override;
 
-    void ready();
+    void ready(bool accepted);
     /**
      * Triggered when a specific channel is ready
      * Used by ConnectionManager::connectDevice()
diff --git a/src/connectionmanager.cpp b/src/connectionmanager.cpp
index 03e4c6573771429f57fcb11c1b3062d44f22d365..17206d3c3e49bcd817fa1a974ef19568afcd4fbe 100644
--- a/src/connectionmanager.cpp
+++ b/src/connectionmanager.cpp
@@ -642,7 +642,7 @@ ConnectionManager::Impl::connectDevice(const std::shared_ptr<dht::crypto::Certif
                 const auto& pendings = pendingsIt->second;
                 while (pendings.connecting.find(vid) != pendings.connecting.end()
                        && pendings.waiting.find(vid) != pendings.waiting.end()) {
-                    vid = ValueIdDist(1, JAMI_ID_MAX_VAL)(sthis->account.rand);
+                    vid = ValueIdDist(1, ID_MAX_VAL)(sthis->rand);
                 }
             }
             // Check if already connecting
diff --git a/src/multiplexed_socket.cpp b/src/multiplexed_socket.cpp
index 5abf7427ed0ce70bc27af87784851f6eca0967ff..dd6c298354e41560f262f1115a7e6a8b0b05bbec 100644
--- a/src/multiplexed_socket.cpp
+++ b/src/multiplexed_socket.cpp
@@ -283,7 +283,7 @@ MultiplexedSocket::Impl::onAccept(const std::string& name, uint16_t channel)
     }
 
     onChannelReady_(deviceId, socket);
-    socket->ready();
+    socket->ready(true);
     // Due to the callbacks that can take some time, onAccept can arrive after
     // receiving all the data. In this case, the socket should be removed here
     // as handle by onChannelReady_
@@ -420,7 +420,7 @@ MultiplexedSocket::Impl::onRequest(const std::string& name, uint16_t channel)
 
     if (accept) {
         onChannelReady_(deviceId, channelSocket);
-        channelSocket->ready();
+        channelSocket->ready(true);
     }
 }
 
@@ -448,6 +448,7 @@ MultiplexedSocket::Impl::handleControlPacket(std::vector<uint8_t>&& pkt)
                     std::lock_guard<std::mutex> lkSockets(pimpl.socketsMutex);
                     auto channel = pimpl.sockets.find(req.channel);
                     if (channel != pimpl.sockets.end()) {
+                        channel->second->ready(false);
                         channel->second->stop();
                         pimpl.sockets.erase(channel);
                     }
@@ -1074,10 +1075,10 @@ ChannelSocket::isAnswered() const
 }
 
 void
-ChannelSocket::ready()
+ChannelSocket::ready(bool accepted)
 {
     if (pimpl_->readyCb_)
-        pimpl_->readyCb_();
+        pimpl_->readyCb_(accepted);
 }
 
 void