connectionmanager: remove connecton if TLS negotiation fails
If a TLS handshake was failing, the device information was not
correctly removed, causing a connection to be detected and further
communications to fail.
So, while monitoring, some connections were stuck in "Connecting TLS".
Moreover, remove waitForReady because it's unused
Change-Id: I8350d7f8731311ab46db78fb26328edc0dcb31dc
diff --git a/src/connectionmanager.cpp b/src/connectionmanager.cpp
index 68f40b1..7c3c8d2 100644
--- a/src/connectionmanager.cpp
+++ b/src/connectionmanager.cpp
@@ -1185,6 +1185,13 @@
vid);
dinfo->executePendingOperations(vid, nullptr);
}
+
+ std::unique_lock<std::mutex> lk(dinfo->mtx_);
+ dinfo->info.erase(vid);
+
+ if (dinfo->empty()) {
+ infos_.removeDeviceInfo(dinfo->deviceId);
+ }
} else {
// The socket is ready, store it
if (isDhtRequest) {