From f2cf653eb9967dc9ee26cbe7a43d1815bd526563 Mon Sep 17 00:00:00 2001 From: dec05eba <0xdec05eba@gmail.com> Date: Mon, 21 May 2018 08:26:02 +0200 Subject: Add methods to allow pinging --- include/odhtdb/Database.hpp | 8 ++++++-- include/odhtdb/DhtKey.hpp | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/odhtdb/Database.hpp b/include/odhtdb/Database.hpp index 6874fe0..a5fcb60 100644 --- a/include/odhtdb/Database.hpp +++ b/include/odhtdb/Database.hpp @@ -196,10 +196,14 @@ namespace odhtdb std::vector getUserGroups(const Hash &nodeHash, const Signature::PublicKey &userPublicKey) const; - void receiveCustomMessage(const dht::InfoHash &requestKey, ReceiveCustomMessageCallbackFunc callbackFunc); + std::future receiveCustomMessage(const dht::InfoHash &requestKey, ReceiveCustomMessageCallbackFunc callbackFunc); + + void sendCustomMessage(const dht::InfoHash &key, std::vector &&data); // Return true in @callbackFunc if you want to continue listening for responses, otherwise return false - void sendCustomMessage(const dht::InfoHash &key, std::vector &&data, SendCustomMessageCallbackFunc callbackFunc); + std::future sendCustomMessage(const dht::InfoHash &key, std::vector &&data, SendCustomMessageCallbackFunc callbackFunc); + + void cancelNodeListener(const dht::InfoHash &infoHash, std::future &nodeListener); int clearCache(); diff --git a/include/odhtdb/DhtKey.hpp b/include/odhtdb/DhtKey.hpp index c3398bf..959bb65 100644 --- a/include/odhtdb/DhtKey.hpp +++ b/include/odhtdb/DhtKey.hpp @@ -13,6 +13,7 @@ namespace odhtdb dht::InfoHash getNewDataListenerKey(); dht::InfoHash getRequestOldDataKey(); + dht::InfoHash getPingKey(); private: dht::InfoHash infoHash; unsigned char firstByteOriginalValue; -- cgit v1.2.3