diff options
author | dec05eba <0xdec05eba@gmail.com> | 2018-10-16 05:23:57 +0200 |
---|---|---|
committer | dec05eba <0xdec05eba@gmail.com> | 2018-10-16 05:24:00 +0200 |
commit | 1169a73ef72e296cc79da746b5d6d916714633c2 (patch) | |
tree | ebf4f42585acfbee4831b2a8890e837ccbd4fec7 /src | |
parent | 13f2007d104149f69ab7a794d2e119830e638eaa (diff) |
Listen on key when sending custom message
Diffstat (limited to 'src')
-rw-r--r-- | src/Database.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Database.cpp b/src/Database.cpp index 2a7a510..5ff3460 100644 --- a/src/Database.cpp +++ b/src/Database.cpp @@ -661,6 +661,11 @@ namespace odhtdb void Database::sendCustomMessage(const InfoHash &requestKey, const void *data, const usize size) { + if(!bootstrapConnection.areWeListeningOnKey(requestKey.getKey())) + { + bootstrapConnection.listen(requestKey.getKey(), nullptr); + std::this_thread::sleep_for(std::chrono::seconds(3)); + } bootstrapConnection.put(requestKey.getKey(), data, size); } @@ -674,7 +679,7 @@ namespace odhtdb return callbackFunc(true, data, size); }); - bootstrapConnection.put(requestKey.getKey(), data, size); + sendCustomMessage(requestKey, data, size); return listener; } |