aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-10-16 02:43:11 +0200
committerdec05eba <dec05eba@protonmail.com>2018-10-16 02:43:15 +0200
commit84140dc704156cb91fc51fa01654e6fe4b1228e5 (patch)
treea088c9be084731771125e45f92e4d23a4ed9d3c4 /src
parent1d46ddded3ded4dd44e3d7ede544ea215b3e917e (diff)
Update opendht dependency, probably broken
Diffstat (limited to 'src')
-rw-r--r--src/Channel.cpp4
-rw-r--r--src/main.cpp12
2 files changed, 9 insertions, 7 deletions
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 <ntp/NtpClient.hpp>
#include <sibs/SafeSerializer.hpp>
#include <X11/Xlib.h>
+#include <math.h>
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, &currentUsername, &currentPassword, &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, &currentUsername, &currentPassword, &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;
});