From eda9a7bbefc5587bf1ff895a9214f450e64575fa Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 5 Mar 2018 22:45:56 +0100 Subject: 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. --- src/DhtKey.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/DhtKey.cpp (limited to 'src/DhtKey.cpp') 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; + } +} -- cgit v1.2.3