From 7883c14baeaf28fc2330e52679a77faefa2649e5 Mon Sep 17 00:00:00 2001 From: Petr Date: Fri, 6 Sep 2024 16:05:15 +0200 Subject: [PATCH] Close connection if login phase is timeouted --- libshviotqt/src/rpc/clientconnection.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libshviotqt/src/rpc/clientconnection.cpp b/libshviotqt/src/rpc/clientconnection.cpp index 2e5ce8a1c..636d3f031 100644 --- a/libshviotqt/src/rpc/clientconnection.cpp +++ b/libshviotqt/src/rpc/clientconnection.cpp @@ -436,6 +436,12 @@ void ClientConnection::onSocketConnectedChanged(bool is_connected) setState(State::BrokerConnected); } else { + QTimer::singleShot(cp::RpcDriver::defaultRpcTimeoutMsec(), this, [this] () { + if (state() != State::BrokerConnected) { + // login timeout + close(); + } + }); sendHello(); } }