Commit 79a55d8e authored by Albert Vaca Cintora's avatar Albert Vaca Cintora

Fixed landevice link not setting the payload to the proper package

Wrong variable name
parent ddbbafab
......@@ -89,29 +89,31 @@ void LanDeviceLink::dataReceived()
if (package.length() < 3) continue;
NetworkPackage np(QString::null);
NetworkPackage::unserialize(package, &np);
if (np.type() == PACKAGE_TYPE_ENCRYPTED) {
if (mPrivateKey.isNull()) {
//TODO: Emit the problem?
NetworkPackage unserialized(QString::null);
NetworkPackage::unserialize(package, &unserialized);
if (unserialized.isEncrypted()) {
//mPrivateKey should always be set when device link is added to device, no null-checking done here
NetworkPackage decrypted(QString::null);
np.decrypt(mPrivateKey, &decrypted);
unserialized.decrypt(mPrivateKey, &decrypted);
if (np.hasPayloadTransferInfo()) {
DownloadJob* job = new DownloadJob(mSocket->peerAddress(), np.payloadTransferInfo());
if (decrypted.hasPayloadTransferInfo()) {
qDebug() << "HasPayloadTransferInfo";
DownloadJob* job = new DownloadJob(mSocket->peerAddress(), decrypted.payloadTransferInfo());
Q_EMIT receivedPackage(decrypted);
} else {
Q_EMIT receivedPackage(np);
if (unserialized.hasPayloadTransferInfo()) {
//Lets ignore unencrypted payloads
Q_EMIT receivedPackage(unserialized);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment