Skip to content
Snippets Groups Projects
Commit 6be3b469 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

connectionmanager: remove unwanted re-schedule on IO pool

Change-Id: Ic2f1cf4151e55f5f6a1fc18c857c90143656ad35
parent 120eb26b
No related branches found
No related tags found
No related merge requests found
......@@ -317,14 +317,15 @@ ConnectionManager::Impl::connectDeviceStartIce(
// Send connection request through DHT
JAMI_DBG() << account << "Request connection to " << deviceId;
account.dht()->putEncrypted(dht::InfoHash::get(PeerConnectionRequest::key_prefix
+ devicePk->getId().toString()),
account.dht()->putEncrypted(
dht::InfoHash::get(PeerConnectionRequest::key_prefix + devicePk->getId().toString()),
devicePk,
value,
[deviceId](bool ok) {
if (!ok)
JAMI_ERR("Tried to send request to %s, but put failed",
deviceId.to_c_str());
[deviceId, accId = account.getAccountID()](bool ok) {
JAMI_DEBUG("[Account {:s}] Send connection request to {:s}. Put encrypted {:s}",
accId,
deviceId.toString(),
(ok ? "ok" : "failed"));
});
// Wait for call to onResponse() operated by DHT
if (isDestroying_)
......@@ -682,16 +683,6 @@ ConnectionManager::Impl::onDhtConnected(const dht::crypto::PublicKey& devicePk)
} else {
JAMI_DBG() << "Received request from " << req.owner->getLongId();
}
// Hack:
// Note: This reschedule on the io pool should not be necessary
// however https://git.jami.net/savoirfairelinux/ring-daemon/-/issues/421
// is a bit clueless and not reproductible in a debug env for now. However,
// the behavior makes me think this callback is blocked (maybe in getInfos())
// and this must never happen.
dht::ThreadPool::io().run([w, req = std::move(req)] {
auto shared = w.lock();
if (!shared)
return;
if (req.isAnswer) {
shared->onPeerResponse(req);
} else {
......@@ -706,7 +697,8 @@ ConnectionManager::Impl::onDhtConnected(const dht::crypto::PublicKey& devicePk)
dht::InfoHash peer_h;
if (AccountManager::foundPeerDevice(cert, peer_h)) {
#if TARGET_OS_IOS
if ((req.connType == "videoCall" || req.connType == "audioCall") && jami::Manager::instance().isIOSExtension) {
if ((req.connType == "videoCall" || req.connType == "audioCall")
&& jami::Manager::instance().isIOSExtension) {
bool hasVideo = req.connType == "videoCall";
emitSignal<DRing::ConversationSignal::CallConnectionRequest>(
shared->account.getAccountID(), peer_h.toString(), hasVideo);
......@@ -715,13 +707,12 @@ ConnectionManager::Impl::onDhtConnected(const dht::crypto::PublicKey& devicePk)
#endif
shared->onDhtPeerRequest(req, cert);
} else {
JAMI_WARN() << shared->account
<< "Rejected untrusted connection request from "
JAMI_WARN()
<< shared->account << "Rejected untrusted connection request from "
<< req.owner->getLongId();
}
});
}
});
return true;
},
......@@ -805,10 +796,11 @@ ConnectionManager::Impl::answerTo(IceTransport& ice,
dht::InfoHash::get(PeerConnectionRequest::key_prefix + from->getId().toString()),
from,
value,
[from](bool ok) {
if (!ok)
JAMI_ERR("Tried to answer to connection request from %s, but put failed",
from->getLongId().to_c_str());
[from, accId = account.getAccountID()](bool ok) {
JAMI_DEBUG("[Account {:s}] Answer to connection request from {:s}. Put encrypted {:s}",
accId,
from->getLongId().toString(),
(ok ? "ok" : "failed"));
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment