From 84140dc704156cb91fc51fa01654e6fe4b1228e5 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 16 Oct 2018 02:43:11 +0200 Subject: Update opendht dependency, probably broken --- src/Channel.cpp | 4 ++-- src/main.cpp | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/Channel.cpp b/src/Channel.cpp index 82f8ef0..501e5bc 100644 --- a/src/Channel.cpp +++ b/src/Channel.cpp @@ -87,7 +87,7 @@ namespace dchat if(database) { - database->cancelNodeListener(pingKey, pingListener); + database->cancelNodeListener(pingListener); database->stopSeeding(*databaseNodeInfo.getRequestHash()); sendPing(0); } @@ -387,7 +387,7 @@ namespace dchat signedSerializer.add(pingTimestampSec); string signedData = onlineLocalUser->keyPair.getPrivateKey().sign(odhtdb::DataView(signedSerializer.getBuffer().data(), signedSerializer.getBuffer().size())); serializer.add((const u8*)signedData.data(), signedData.size()); - database->sendCustomMessage(pingKey, move(serializer.getBuffer())); + database->sendCustomMessage(pingKey, serializer.getBuffer().data(), serializer.getBuffer().size()); } } diff --git a/src/main.cpp b/src/main.cpp index efb354f..3abff99 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -25,6 +25,7 @@ #include #include #include +#include using namespace std; using namespace dchat; @@ -397,7 +398,7 @@ int main(int argc, char **argv) } } }; - database = new odhtdb::Database("bootstrap.ring.cx", 4222, Cache::getDchatDir(), callbackFuncs); + database = new odhtdb::Database("206.189.13.66", 27130, Cache::getDchatDir(), callbackFuncs); auto addSystemMessage = [&lastFocusedTimer](const std::string &msg, bool plainText = true) { @@ -550,7 +551,7 @@ int main(int argc, char **argv) sibs::SafeSerializer keySerializer; keySerializer.add((const u8*)channelNodeHash->getData(), channelNodeHash->getSize()); keySerializer.add((const u8*)encryptionKey->data, odhtdb::ENCRYPTION_KEY_BYTE_SIZE); - dht::InfoHash key = odhtdb::Database::getInfoHash(keySerializer.getBuffer().data(), keySerializer.getBuffer().size()); + odhtdb::InfoHash key = odhtdb::Database::getInfoHash(keySerializer.getBuffer().data(), keySerializer.getBuffer().size()); database->receiveCustomMessage(key, [&channelMessageMutex, encryptionKey, channelEncryptionKey, currentChannel, &database](const void *data, usize size) { // TODO: User can remove channel @currentChannel before we get here, meaning @currentChannel is deleted and would be invalid; causing the program to crash @@ -648,8 +649,10 @@ int main(int argc, char **argv) sibs::SafeSerializer keySerializer; keySerializer.add((const u8*)nodeHash->getData(), nodeHash->getSize()); keySerializer.add((const u8*)encryptionKeyBinRaw.data(), odhtdb::ENCRYPTION_KEY_BYTE_SIZE); - dht::InfoHash key = odhtdb::Database::getInfoHash(keySerializer.getBuffer().data(), keySerializer.getBuffer().size()); - database->sendCustomMessage(key, move(serializer.getBuffer()), [&database, nodeHash, encryptionKey, &waitingToJoinChannels, &channelMessageMutex, keyPair, ¤tUsername, ¤tPassword, &localNodeUsers](bool gotResponse, const void *data, usize size) + odhtdb::InfoHash key = odhtdb::Database::getInfoHash(keySerializer.getBuffer().data(), keySerializer.getBuffer().size()); + database->sendCustomMessage(key, serializer.getBuffer().data(), serializer.getBuffer().size(), + [&database, nodeHash, encryptionKey, &waitingToJoinChannels, &channelMessageMutex, keyPair, ¤tUsername, ¤tPassword, &localNodeUsers] + (bool gotResponse, const void *data, usize size) { if(!gotResponse) { @@ -695,7 +698,6 @@ int main(int argc, char **argv) fprintf(stderr, "Failed while parsing join response for invite link, reason: %s\n", e.what()); } return true; - }); waitingToJoin = true; }); -- cgit v1.2.3