diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-05-21 08:26:02 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-08-18 23:25:46 +0200 |
commit | ac626d47ebd49188458d70f98c6d871b1b7e3f50 (patch) | |
tree | 0a551e7b87df0561cf30d497cf3a7829d446962d /include | |
parent | 24ee6bcc7ef8877ff00bbafc003aac76d756f9bc (diff) |
Add methods to allow pinging
Diffstat (limited to 'include')
-rw-r--r-- | include/odhtdb/Database.hpp | 8 | ||||
-rw-r--r-- | include/odhtdb/DhtKey.hpp | 1 |
2 files changed, 7 insertions, 2 deletions
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<OwnedByteArray> getUserGroups(const Hash &nodeHash, const Signature::PublicKey &userPublicKey) const; - void receiveCustomMessage(const dht::InfoHash &requestKey, ReceiveCustomMessageCallbackFunc callbackFunc); + std::future<size_t> receiveCustomMessage(const dht::InfoHash &requestKey, ReceiveCustomMessageCallbackFunc callbackFunc); + + void sendCustomMessage(const dht::InfoHash &key, std::vector<u8> &&data); // Return true in @callbackFunc if you want to continue listening for responses, otherwise return false - void sendCustomMessage(const dht::InfoHash &key, std::vector<u8> &&data, SendCustomMessageCallbackFunc callbackFunc); + std::future<size_t> sendCustomMessage(const dht::InfoHash &key, std::vector<u8> &&data, SendCustomMessageCallbackFunc callbackFunc); + + void cancelNodeListener(const dht::InfoHash &infoHash, std::future<size_t> &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; |