From b5cb38c25336e65a9d3295e6e2f19d548470a91a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <contact@enconn.fr>
Date: Mon, 9 Apr 2018 13:55:26 -0400
Subject: [PATCH] datatransfer: remove useless publicAddresses call

This also fix a deadlock when calling this function inside a callback
called when no peer has been found.

Change-Id: I0a8af8fc7ccfa638fdae9da957275a578b43879e
---
 src/ringdht/p2p.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/ringdht/p2p.cpp b/src/ringdht/p2p.cpp
index 1d8918b6c2..9d85531c4e 100644
--- a/src/ringdht/p2p.cpp
+++ b/src/ringdht/p2p.cpp
@@ -699,12 +699,11 @@ DhtPeerConnector::closeConnection(const std::string& peer_id, const DRing::DataT
     // will be determined via the pair (dev_h, tid).
     // That's why we need to call CANCEL for the peer_h and each dev_h.
     const auto peer_h = dht::InfoHash(peer_id);
-    auto addresses = pimpl_->account.publicAddresses();
 
     pimpl_->ctrl << makeMsg<CtrlMsgType::CANCEL>(peer_h, tid);
     pimpl_->account.forEachDevice(
         peer_h,
-        [this, addresses, tid](const std::shared_ptr<RingAccount>& account,
+        [this, tid](const std::shared_ptr<RingAccount>& account,
                           const dht::InfoHash& dev_h) {
             if (dev_h == account->dht().getId()) {
                 RING_ERR() << account << "[CNX] no connection to yourself, bad person!";
-- 
GitLab