diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-05-21 01:02:11 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-08-18 23:25:46 +0200 |
commit | 4e9ca6c06dc954f9deffe7d1680ef14c06990f2c (patch) | |
tree | 022936dc7fcace09a73f1aaebe0e3a57896059fa /include | |
parent | 63ea3c4f7fd0cd094c0b65dd57c8b991b29bbb32 (diff) |
Ping node before sending old data
Diffstat (limited to 'include')
-rw-r--r-- | include/odhtdb/Database.hpp | 3 | ||||
-rw-r--r-- | include/odhtdb/DatabaseStorage.hpp | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/include/odhtdb/Database.hpp b/include/odhtdb/Database.hpp index a2914ac..6874fe0 100644 --- a/include/odhtdb/Database.hpp +++ b/include/odhtdb/Database.hpp @@ -201,8 +201,11 @@ namespace odhtdb // 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); + int clearCache(); + static dht::InfoHash getInfoHash(const void *data, usize size); private: + void sendOldDataToPeer(const DatabaseNode nodeToSeed, const std::shared_ptr<dht::InfoHash> requestResponseInfoHash, const std::shared_ptr<dht::Value> value, usize valueOffset); void deserializeCreateRequest(const std::shared_ptr<dht::Value> &value, const Hash &hash, const std::shared_ptr<OwnedByteArray> encryptionKey); void deserializeAddRequest(const std::shared_ptr<dht::Value> &value, const Hash &requestDataHash, const std::shared_ptr<Hash> &nodeHash, const std::shared_ptr<OwnedByteArray> encryptionKey); bool listenCreateData(std::shared_ptr<dht::Value> value, const Hash &hash, const std::shared_ptr<OwnedByteArray> encryptionKey); diff --git a/include/odhtdb/DatabaseStorage.hpp b/include/odhtdb/DatabaseStorage.hpp index 9f93994..757fbfd 100644 --- a/include/odhtdb/DatabaseStorage.hpp +++ b/include/odhtdb/DatabaseStorage.hpp @@ -148,6 +148,9 @@ namespace odhtdb // Update storage state (remove quarantine objects if they are too old, etc) void update(); + + // Return number of bytes cleared + int clearCache(); private: void init(const boost::filesystem::path &storagePath); void cleanup(); |