From 0067ce8272ce7ce28367512037b05118df214e0b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Fri, 30 Jul 2021 11:00:52 -0400
Subject: [PATCH] jamiaccount: negotiate SIP channel with account's device

To send git notifications when sending messages.

Change-Id: Idb1d68dddccfaec4517e8b29fbbcf2f971566c59
---
 src/jamidht/jamiaccount.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/jamidht/jamiaccount.cpp b/src/jamidht/jamiaccount.cpp
index 8118ac5966..c3c0e28be4 100644
--- a/src/jamidht/jamiaccount.cpp
+++ b/src/jamidht/jamiaccount.cpp
@@ -2189,7 +2189,7 @@ JamiAccount::doRegister_()
                     if (accountManager_->getInfo()->deviceId == deviceId)
                         return;
 
-                    std::lock_guard<std::mutex> lk(connManagerMtx_);
+                    std::unique_lock<std::mutex> lk(connManagerMtx_);
                     if (!connectionManager_)
                         connectionManager_ = std::make_unique<ConnectionManager>(*this);
                     auto channelName = "sync://" + deviceId;
@@ -2206,6 +2206,10 @@ JamiAccount::doRegister_()
                                                           if (socket)
                                                               syncWith(deviceId, socket);
                                                       });
+                    lk.unlock();
+                    requestSIPConnection(
+                        getUsername(),
+                        crt->getLongId()); // For git notifications, will use the same socket as sync
                 },
                 [this] {
                     deviceAnnounced_ = true;
-- 
GitLab