Fix SyncthingConnection::connectLater()

This commit is contained in:
Martchus 2019-02-06 17:35:21 +01:00
parent 310e4bdc73
commit dc5f2d99e2
1 changed files with 5 additions and 1 deletions

View File

@ -229,10 +229,14 @@ void SyncthingConnection::connect(SyncthingConnectionSettings &connectionSetting
} }
} }
/*!
* \brief Connects in \a milliSeconds. Useful to "schedule" another attempt in case of a failure.
* \remarks Does nothing if the connection attempt would happen anyways though auto-reconnect.
*/
void SyncthingConnection::connectLater(int milliSeconds) void SyncthingConnection::connectLater(int milliSeconds)
{ {
// skip if conneting via auto-reconnect anyways // skip if conneting via auto-reconnect anyways
if (autoReconnectInterval() > 0 && milliSeconds < autoReconnectInterval()) { if (autoReconnectInterval() > 0 && milliSeconds > autoReconnectInterval()) {
return; return;
} }
QTimer::singleShot(milliSeconds, this, static_cast<void (SyncthingConnection::*)(void)>(&SyncthingConnection::connect)); QTimer::singleShot(milliSeconds, this, static_cast<void (SyncthingConnection::*)(void)>(&SyncthingConnection::connect));