diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-03-05 22:45:56 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-08-18 23:25:46 +0200 |
commit | eda9a7bbefc5587bf1ff895a9214f450e64575fa (patch) | |
tree | 0f968fb7373a29cf116b4b6d473a966e28e62825 /src/DhtKey.cpp | |
parent | 33e823ddddddd4a13b1a05b90ae5b419b89bcb1d (diff) |
Implement 'create' operation, add seeding
Seeding is currently only done on the key you specify, in the future
the user should request data that it can seed.
Diffstat (limited to 'src/DhtKey.cpp')
-rw-r--r-- | src/DhtKey.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/DhtKey.cpp b/src/DhtKey.cpp new file mode 100644 index 0000000..ea59740 --- /dev/null +++ b/src/DhtKey.cpp @@ -0,0 +1,22 @@ +#include "../include/DhtKey.hpp" +#include "../include/types.hpp" + +namespace odhtdb +{ + DhtKey::DhtKey(const Hash &key) : infoHash((const u8*)key.getData(), key.getSize()) + { + firstByteOriginalValue = infoHash[0]; + } + + const dht::InfoHash& DhtKey::getNewDataListenerKey() + { + infoHash[0] = firstByteOriginalValue; + return infoHash; + } + + const dht::InfoHash& DhtKey::getRequestOldDataKey() + { + infoHash[0] = firstByteOriginalValue + 1; + return infoHash; + } +} |