Commit 26808a4b authored by Christian Kandeler's avatar Christian Kandeler
Browse files

Maemo: State machine bugfixes in remote process execution.

Reviewed-by: kh1
parent 983bc5d2
...@@ -126,7 +126,7 @@ void MaemoSshRunner::handleConnected() ...@@ -126,7 +126,7 @@ void MaemoSshRunner::handleConnected()
void MaemoSshRunner::handleConnectionFailure() void MaemoSshRunner::handleConnectionFailure()
{ {
if (m_state != Inactive) if (m_state == Inactive)
qWarning("Unexpected state %d in %s.", m_state, Q_FUNC_INFO); qWarning("Unexpected state %d in %s.", m_state, Q_FUNC_INFO);
const QString errorTemplate = m_state == Connecting const QString errorTemplate = m_state == Connecting
...@@ -165,8 +165,10 @@ void MaemoSshRunner::handleCleanupFinished(int exitStatus) ...@@ -165,8 +165,10 @@ void MaemoSshRunner::handleCleanupFinished(int exitStatus)
|| exitStatus == SshRemoteProcess::ExitedNormally); || exitStatus == SshRemoteProcess::ExitedNormally);
ASSERT_STATE(QList<State>() << PreRunCleaning << PostRunCleaning ASSERT_STATE(QList<State>() << PreRunCleaning << PostRunCleaning
<< StopRequested); << StopRequested << Inactive);
if (m_state == Inactive)
return;
if (m_state == StopRequested || m_state == PostRunCleaning) { if (m_state == StopRequested || m_state == PostRunCleaning) {
unmount(); unmount();
return; return;
...@@ -247,7 +249,7 @@ void MaemoSshRunner::handleMounted() ...@@ -247,7 +249,7 @@ void MaemoSshRunner::handleMounted()
void MaemoSshRunner::handleMounterError(const QString &errorMsg) void MaemoSshRunner::handleMounterError(const QString &errorMsg)
{ {
ASSERT_STATE(QList<State>() << PreRunCleaning << PostRunCleaning ASSERT_STATE(QList<State>() << PreRunCleaning << PostRunCleaning
<< PreMountUnmounting << Mounting << StopRequested); << PreMountUnmounting << Mounting << StopRequested << Inactive);
emitError(errorMsg); emitError(errorMsg);
} }
...@@ -279,10 +281,10 @@ void MaemoSshRunner::handleRemoteProcessFinished(int exitStatus) ...@@ -279,10 +281,10 @@ void MaemoSshRunner::handleRemoteProcessFinished(int exitStatus)
Q_ASSERT(exitStatus == SshRemoteProcess::FailedToStart Q_ASSERT(exitStatus == SshRemoteProcess::FailedToStart
|| exitStatus == SshRemoteProcess::KilledBySignal || exitStatus == SshRemoteProcess::KilledBySignal
|| exitStatus == SshRemoteProcess::ExitedNormally); || exitStatus == SshRemoteProcess::ExitedNormally);
ASSERT_STATE(QList<State>() << ProcessStarting << StopRequested); ASSERT_STATE(QList<State>() << ProcessStarting << StopRequested << Inactive);
m_exitStatus = exitStatus; m_exitStatus = exitStatus;
if (m_state != StopRequested) { if (m_state != StopRequested && m_state != Inactive) {
setState(PostRunCleaning); setState(PostRunCleaning);
cleanup(); cleanup();
} }
......
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