Do not let lanlink connections stay open for long without authenticating
If there's no information received, close the socket to try again. Thanks Matthias Gerstner <mgerstner@suse.de> for reporting this.
This commit is contained in:
parent
4fbd01a3d4
commit
024e5f23db
1 changed files with 10 additions and 0 deletions
|
@ -392,6 +392,16 @@ void LanLinkProvider::newConnection()
|
||||||
connect(socket, &QIODevice::readyRead,
|
connect(socket, &QIODevice::readyRead,
|
||||||
this, &LanLinkProvider::dataReceived);
|
this, &LanLinkProvider::dataReceived);
|
||||||
|
|
||||||
|
QTimer* timer = new QTimer(socket);
|
||||||
|
timer->setSingleShot(true);
|
||||||
|
timer->setInterval(1000);
|
||||||
|
connect(socket, &QSslSocket::encrypted,
|
||||||
|
timer, &QObject::deleteLater);
|
||||||
|
connect(timer, &QTimer::timeout, socket, [socket] {
|
||||||
|
qCWarning(KDECONNECT_CORE) << "LanLinkProvider/newConnection: Host timed out without sending any identity." << socket->peerAddress();
|
||||||
|
socket->disconnectFromHost();
|
||||||
|
});
|
||||||
|
timer->start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue