summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-10-06 20:27:13 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-10-06 20:27:13 (GMT)
commitab1f93612a42eb6efefd285fd483a1af6a619f3a (patch)
tree492b05034857bbbdc401fd737a9216663d145e02
parent08f535009a8530e07274d08abb334e132b057b46 (diff)
Checking for timeout in both Ekos starting phase and when connecting INDI devices. Better fail than wait forever
-rw-r--r--kstars/ekos/scheduler.cpp19
-rw-r--r--kstars/ekos/scheduler.h2
2 files changed, 21 insertions, 0 deletions
diff --git a/kstars/ekos/scheduler.cpp b/kstars/ekos/scheduler.cpp
index 403e702..2961e2b 100644
--- a/kstars/ekos/scheduler.cpp
+++ b/kstars/ekos/scheduler.cpp
@@ -1915,6 +1915,9 @@ bool Scheduler::checkEkosState()
{
ekosInterface->call(QDBus::AutoDetect,"start");
ekosState = EKOS_STARTING;
+
+ currentOperationTime = QTime::currentTime();
+
return false;
}
}
@@ -1937,6 +1940,13 @@ bool Scheduler::checkEkosState()
stop();
return false;
}
+ // If a minute passed, give up
+ else if (currentOperationTime.elapsed() > 60)
+ {
+ appendLogText(i18n("Ekos timed out."));
+ stop();
+ return false;
+ }
}
break;
@@ -1977,6 +1987,8 @@ bool Scheduler::checkINDIState()
ekosInterface->call(QDBus::AutoDetect,"connectDevices");
indiState = INDI_CONNECTING;
+ currentOperationTime = QTime::currentTime();
+
if (Options::verboseLogging())
qDebug() << "Scheduler: Connecting INDI Devices";
@@ -2007,6 +2019,13 @@ bool Scheduler::checkINDIState()
stop();
return false;
}
+ // If a minute passed, we give up
+ else if (currentOperationTime.elapsed() > 60)
+ {
+ appendLogText(i18n("INDI devices connection timed out. Check INDI control panel for details."));
+ stop();
+ return false;
+ }
else
return false;
}
diff --git a/kstars/ekos/scheduler.h b/kstars/ekos/scheduler.h
index 51a31b7..b7c4a88 100644
--- a/kstars/ekos/scheduler.h
+++ b/kstars/ekos/scheduler.h
@@ -552,6 +552,8 @@ private:
QTimer schedulerTimer; // To call checkStatus
QTimer jobTimer; // To call checkJobStage
+ QTime currentOperationTime; // Generic time to track timeout of current operation in progress
+
QUrl dirPath;