fix keepalive being multiplied in server timeout (#4663)

* fix keepalive being multiplied in server timeout

a timeout happened after the client not receiving anything for
keepalive * keepalive * maxtimeout (5 * 5 * 10) seconds instead of what
you'd expect, it now only uses keepalive once instead of twice this
means it should now take 50 seconds to time out when disconnected

* change timeout to 15 seconds instead

change time between pings to 3 from 5 seconds
change timout to 5 from 10 repeats
This commit is contained in:
ebbit1q 2022-09-01 02:38:10 +02:00 committed by GitHub
parent b5305aa5e4
commit 2f100f2ba3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 4 deletions

View file

@ -541,10 +541,9 @@ void RemoteClient::ping()
} }
} }
int keepalive = SettingsCache::instance().getKeepAlive();
int maxTime = timeRunning - lastDataReceived; int maxTime = timeRunning - lastDataReceived;
emit maxPingTime(maxTime, maxTimeout); emit maxPingTime(maxTime, maxTimeout);
if (maxTime >= (keepalive * maxTimeout)) { if (maxTime >= maxTimeout) {
disconnectFromServer(); disconnectFromServer();
emit serverTimeout(); emit serverTimeout();
} else { } else {

View file

@ -89,7 +89,7 @@ private slots:
void submitForgotPasswordChallengeResponse(const Response &response); void submitForgotPasswordChallengeResponse(const Response &response);
private: private:
static const int maxTimeout = 10; static const int maxTimeout = 5;
int timeRunning, lastDataReceived; int timeRunning, lastDataReceived;
QByteArray inputBuffer; QByteArray inputBuffer;
bool messageInProgress; bool messageInProgress;

View file

@ -181,7 +181,7 @@ SettingsCache::SettingsCache()
updateReleaseChannel = settings->value("personal/updatereleasechannel", 0).toInt(); updateReleaseChannel = settings->value("personal/updatereleasechannel", 0).toInt();
lang = settings->value("personal/lang").toString(); lang = settings->value("personal/lang").toString();
keepalive = settings->value("personal/keepalive", 5).toInt(); keepalive = settings->value("personal/keepalive", 3).toInt();
// tip of the day settings // tip of the day settings
showTipsOnStartup = settings->value("tipOfDay/showTips", true).toBool(); showTipsOnStartup = settings->value("tipOfDay/showTips", true).toBool();