Skip to content

Commit

Permalink
ConnectionManager: register pending ids on request
Browse files Browse the repository at this point in the history
And remove unneeded check added in previous commit

Change-Id: I1b1f946fde02a09c9695b1f092c041fbd9278e06
  • Loading branch information
aberaud committed Oct 22, 2024
1 parent 16e03dc commit 7da115a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/connectionmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -923,11 +923,6 @@ ConnectionManager::Impl::connectDevice(const std::shared_ptr<dht::crypto::Certif
std::unique_lock lk(di->mtx_);
if (!di->cert) {
di->cert = cert;
} else if (di->cert->getLongId() != deviceId) {
if (sthis->config_->logger)
sthis->config_->logger->error("[device {}] Certificate mismatch", deviceId);
cb(nullptr, deviceId);
return;
}

dht::Value::Id vid;
Expand Down Expand Up @@ -1281,10 +1276,12 @@ ConnectionManager::Impl::onTlsNegotiationDone(const std::shared_ptr<DeviceInfo>&
std::unique_lock lk2 {dinfo->mtx_};
auto pendingIds = dinfo->requestPendingOps();
auto previousConnections = dinfo->getConnectedInfos();
lk2.unlock();
std::unique_lock lk {info->mutex_};
addNewMultiplexedSocket(dinfo, deviceId, vid, info);
for (const auto& [id, name]: pendingIds)
info->cbIds_.emplace(id);
lk.unlock();
lk2.unlock();
// send beacon to existing connections for this device
if (config_->logger and not previousConnections.empty())
config_->logger->warn("[device {}] Sending beacon to {} existing connections",
Expand Down

0 comments on commit 7da115a

Please sign in to comment.