From 3d1e055c7b0a5263166ac89840c9eb89de4f9ef1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Sat, 13 Apr 2019 20:49:43 -0400
Subject: [PATCH] peerdiscovery: always use local node id

---
 src/dhtrunner.cpp | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/dhtrunner.cpp b/src/dhtrunner.cpp
index 86521bbe..e0d106c0 100644
--- a/src/dhtrunner.cpp
+++ b/src/dhtrunner.cpp
@@ -161,9 +161,9 @@ DhtRunner::run(const SockAddr& local4, const SockAddr& local6, const DhtRunner::
     }
     if (config.peer_publish) {
         if (peerDiscovery4_)
-            peerDiscovery4_->startPublish(getNodeId(), getBoundPort(AF_INET));
+            peerDiscovery4_->startPublish(dht_->getNodeId(), getBoundPort(AF_INET));
         if (peerDiscovery6_)
-            peerDiscovery6_->startPublish(getNodeId(), getBoundPort(AF_INET6));
+            peerDiscovery6_->startPublish(dht_->getNodeId(), getBoundPort(AF_INET6));
     }
 }
 
@@ -226,17 +226,17 @@ DhtRunner::dumpTables() const
 InfoHash
 DhtRunner::getId() const
 {
-    if (!activeDht())
-        return {};
-    return activeDht()->getId();
+    if (auto dht = activeDht())
+        return dht->getId();
+    return {};
 }
 
 InfoHash
 DhtRunner::getNodeId() const
 {
-    if (!activeDht())
-        return {};
-    return activeDht()->getNodeId();
+    if (auto dht = activeDht())
+        return dht->getNodeId();
+    return {};
 }
 
 
-- 
GitLab