Commit 024e5f23 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Albert Vaca Cintora
Browse files

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.
parent 4fbd01a3
......@@ -392,6 +392,16 @@ void LanLinkProvider::newConnection()
connect(socket, &QIODevice::readyRead,
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();
}
}
......
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