diff options
author | dec05eba <0xdec05eba@gmail.com> | 2018-05-21 01:02:11 +0200 |
---|---|---|
committer | dec05eba <0xdec05eba@gmail.com> | 2018-05-21 01:02:13 +0200 |
commit | 45c0c31c54d4dd9f164db770ebede5087bbc8aef (patch) | |
tree | 93fd49fbfbff9b5be49791839d005226d5c87e60 /include | |
parent | e46344de86b92da7bb8c6e82c8f668fa5d20357c (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(); |