18#include <opendht/thread_pool.h>
27 , connectionManager_(
cm)
40 if (connectionManager_.isConnecting(deviceId,
channelName)) {
41 JAMI_LOG(
"Already connecting to {}", deviceId);
44 connectionManager_.connectDevice(deviceId,
channelName, std::move(
cb));
50 auto acc = account_.lock();
53 return cert->issuer->getId().toString() == acc->getUsername();
59 std::shared_ptr<dhtnet::ChannelSocket> channel)
61 auto acc = account_.lock();
64 auto deviceId = channel->deviceId();
65 if (
auto sm = acc->syncModule())
66 sm->cacheSyncConnection(std::move(channel),
cert->issuer->getId().toString(),
cert->getLongId());
67 dht::ThreadPool::io().run([
account = account_, deviceId = deviceId.toString()]() {
68 if (auto acc = account.lock())
69 acc->sendProfile(
"", acc->getUsername(), deviceId);
A Channel handler is used to make the link between JamiAccount and ConnectionManager Its role is to m...
void onReady(const std::shared_ptr< dht::crypto::Certificate > &peer, const std::string &name, std::shared_ptr< dhtnet::ChannelSocket > channel) override
Launch sync process.
void connect(const DeviceId &deviceId, const std::string &, ConnectCb &&cb, const std::string &connectionType="", bool forceNewConnection=false) override
Ask for a new sync channel.
SyncChannelHandler(const std::shared_ptr< JamiAccount > &acc, dhtnet::ConnectionManager &cm)
bool onRequest(const std::shared_ptr< dht::crypto::Certificate > &peer, const std::string &name) override
Determine if we accept or not the sync request.
#define JAMI_LOG(formatstr,...)
std::function< void(std::shared_ptr< dhtnet::ChannelSocket >, const DeviceId &)> ConnectCb
void emitSignal(Args... args)
static constexpr const char SYNC_SCHEME[]