Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
fix(core): use correct byte representation when bootstrapping
Browse files Browse the repository at this point in the history
Revert a bug introduced in d126b18
where qTox calls tox_bootstrap() and tox_add_relay() with an invalid
argument, which results in qTox not connecting to the bootstrap nodes
from its list of bootsrap nodes and therefore failing to connect to the
Tox DHT network in the case when that list is the only source of nodes
to connect to. The invalid argument is node's public key, which is
non-nullable but is passed a null due to invalid ToxPk object being
constructed. ToxPk's constructor expects the QByteArray argument to be
the byte representation of a public key, but a textual representation
is passed to it instead, which creats an invalid ToxPk that resolves to
null when queried for public key's bytes for calls to  tox_bootstrap()
and tox_add_relay().

Fixes #4385
  • Loading branch information
nurupo committed May 11, 2017
1 parent 7f006b3 commit 4e5b191
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,9 @@ void Core::bootstrapDht()
QString name = dhtServer.name;
qDebug() << QString("Connecting to %1:%2 (%3)").arg(dhtServerAddress, port, name);
QByteArray address = dhtServer.address.toLatin1();
ToxPk pk{dhtServer.userId.toLatin1()};
// TODO: constucting the pk via ToxId is a workaround
ToxPk pk = ToxId{dhtServer.userId}.getPublicKey();


const uint8_t* pkPtr = reinterpret_cast<const uint8_t*>(pk.getBytes());

Expand Down

0 comments on commit 4e5b191

Please sign in to comment.