Don't addLink twice for the same link

This commit is contained in:
Albert Vaca 2015-12-17 07:44:29 -08:00
parent dd7d4093ed
commit 4c84499e6a
2 changed files with 3 additions and 2 deletions

View file

@ -454,10 +454,9 @@ void LanLinkProvider::addLink(const QString& deviceId, QSslSocket* socket, Netwo
Q_ASSERT(mPairingHandlers.contains(deviceId));
mPairingHandlers[deviceId]->setDeviceLink(deviceLink);
}
Q_EMIT onConnectionReceived(*receivedPackage, deviceLink);
}
Q_EMIT onConnectionReceived(*receivedPackage, deviceLink);
}
LanPairingHandler* LanLinkProvider::createPairingHandler(DeviceLink* link)

View file

@ -246,6 +246,8 @@ void Device::addLink(const NetworkPackage& identityPackage, DeviceLink* link)
{
//qCDebug(KDECONNECT_CORE) << "Adding link to" << id() << "via" << link->provider();
Q_ASSERT(!m_deviceLinks.contains(link));
m_protocolVersion = identityPackage.get<int>("protocolVersion", -1);
if (m_protocolVersion != NetworkPackage::ProtocolVersion) {
qCWarning(KDECONNECT_CORE) << m_deviceName << "- warning, device uses a different protocol version" << m_protocolVersion << "expected" << NetworkPackage::ProtocolVersion;