Use the actual connection origin, so we don't keep all connections open.

This commit is contained in:
Albert Vaca 2016-07-05 12:42:39 +02:00
parent 8c07d88c17
commit 9c736583e2

View file

@ -269,14 +269,16 @@ void LanLinkProvider::encrypted()
disconnect(socket, SIGNAL(encrypted()), this, SLOT(encrypted())); disconnect(socket, SIGNAL(encrypted()), this, SLOT(encrypted()));
disconnect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(sslErrors(QList<QSslError>))); disconnect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(sslErrors(QList<QSslError>)));
Q_ASSERT(socket->mode() != QSslSocket::UnencryptedMode);
LanDeviceLink::ConnectionStarted connectionOrigin = (socket->mode() == QSslSocket::SslClientMode)? LanDeviceLink::Locally : LanDeviceLink::Remotely;
NetworkPackage* receivedPackage = receivedIdentityPackages[socket].np; NetworkPackage* receivedPackage = receivedIdentityPackages[socket].np;
const QString& deviceId = receivedPackage->get<QString>("deviceId"); const QString& deviceId = receivedPackage->get<QString>("deviceId");
addLink(deviceId, socket, receivedPackage, LanDeviceLink::Remotely); addLink(deviceId, socket, receivedPackage, connectionOrigin);
// Copied from connected slot, now delete received package // Copied from connected slot, now delete received package
delete receivedIdentityPackages.take(socket).np; delete receivedIdentityPackages.take(socket).np;
} }
void LanLinkProvider::sslErrors(const QList<QSslError>& errors) void LanLinkProvider::sslErrors(const QList<QSslError>& errors)