diff --git a/include/opendht/dht.h b/include/opendht/dht.h index 46da9994d52a899c7996250566e561e6c7bbc251..e604aa05114e98a125a2b5c985285741029c3143 100644 --- a/include/opendht/dht.h +++ b/include/opendht/dht.h @@ -261,7 +261,7 @@ public: * Get the list of good nodes for local storage saving purposes * The list is ordered to minimize the back-to-work delay. */ - std::vector<NodeExport> exportNodes(); + std::vector<NodeExport> exportNodes() const; std::vector<ValuesExport> exportValues() const; void importValues(const std::vector<ValuesExport>&); diff --git a/include/opendht/dht_interface.h b/include/opendht/dht_interface.h index 82b7bf85cc565cc358eaeec9f7703b12f883f843..e30fc120c4a7c34ec921fc7b2b7d28b2363a4fb4 100644 --- a/include/opendht/dht_interface.h +++ b/include/opendht/dht_interface.h @@ -181,7 +181,7 @@ public: * Get the list of good nodes for local storage saving purposes * The list is ordered to minimize the back-to-work delay. */ - virtual std::vector<NodeExport> exportNodes() = 0; + virtual std::vector<NodeExport> exportNodes() const = 0; virtual std::vector<ValuesExport> exportValues() const = 0; virtual void importValues(const std::vector<ValuesExport>&) = 0; diff --git a/include/opendht/dht_proxy_client.h b/include/opendht/dht_proxy_client.h index 2dae2a68a7f8ab71ab30bd04483e6af7948d2002..71371e8bc717a418f8ea540cedd7dd8acddd8341 100644 --- a/include/opendht/dht_proxy_client.h +++ b/include/opendht/dht_proxy_client.h @@ -235,7 +235,7 @@ public: void insertNode(const InfoHash&, const sockaddr*, socklen_t) { } void insertNode(const NodeExport&) { } std::pair<size_t, size_t> getStoreSize() const { return {}; } - std::vector<NodeExport> exportNodes() { return {}; } + std::vector<NodeExport> exportNodes() const { return {}; } std::vector<ValuesExport> exportValues() const { return {}; } void importValues(const std::vector<ValuesExport>&) {} std::string getStorageLog() const { return {}; } diff --git a/include/opendht/securedht.h b/include/opendht/securedht.h index bc57f17849cc6c6c65ed7ae9f132d8dd72f29bb4..44251d028f62c9bfe7a1ef59651e0f3c817d757b 100644 --- a/include/opendht/securedht.h +++ b/include/opendht/securedht.h @@ -168,7 +168,7 @@ public: void setStorageLimit(size_t limit = DEFAULT_STORAGE_LIMIT) override { dht_->setStorageLimit(limit); } - std::vector<NodeExport> exportNodes() override { + std::vector<NodeExport> exportNodes() const override { return dht_->exportNodes(); } std::vector<ValuesExport> exportValues() const override { diff --git a/src/dht.cpp b/src/dht.cpp index e37c5808b258fca6148ad8f53431e0f605160790..d0ceda3429b16c485587cad5ddfd7c17bc3b9a03 100644 --- a/src/dht.cpp +++ b/src/dht.cpp @@ -2056,7 +2056,7 @@ Dht::importValues(const std::vector<ValuesExport>& import) std::vector<NodeExport> -Dht::exportNodes() +Dht::exportNodes() const { const auto& now = scheduler.time(); std::vector<NodeExport> nodes;