Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
97a56a62
Commit
97a56a62
authored
Oct 01, 2010
by
Christian Kandeler
Browse files
Maemo: Fix UTFS timeout timer not being stopped in some cases.
parent
f7105846
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.cpp
View file @
97a56a62
...
...
@@ -89,7 +89,7 @@ void MaemoRemoteMounter::mount()
if
(
!
m_toolChain
->
allowsRemoteMounts
())
m_mountSpecs
.
clear
();
if
(
m_mountSpecs
.
isEmpty
())
{
m_s
tate
=
Inactive
;
setS
tate
(
Inactive
)
;
emit
reportProgress
(
tr
(
"No directories to mount"
));
emit
mounted
();
}
else
{
...
...
@@ -121,7 +121,7 @@ void MaemoRemoteMounter::unmount()
SLOT
(
handleUnmountProcessFinished
(
int
)));
connect
(
m_unmountProcess
.
data
(),
SIGNAL
(
errorOutputAvailable
(
QByteArray
)),
this
,
SLOT
(
handleUmountStderr
(
QByteArray
)));
m_s
tate
=
Unmounting
;
setS
tate
(
Unmounting
)
;
m_unmountProcess
->
start
();
}
...
...
@@ -131,7 +131,7 @@ void MaemoRemoteMounter::handleUnmountProcessFinished(int exitStatus)
if
(
m_state
==
Inactive
)
return
;
m_s
tate
=
Inactive
;
setS
tate
(
Inactive
)
;
QString
errorMsg
;
switch
(
exitStatus
)
{
...
...
@@ -165,7 +165,7 @@ void MaemoRemoteMounter::handleUnmountProcessFinished(int exitStatus)
void
MaemoRemoteMounter
::
stop
()
{
m_s
tate
=
Inactive
;
setS
tate
(
Inactive
)
;
if
(
m_utfsClientUploader
)
{
disconnect
(
m_utfsClientUploader
.
data
(),
0
,
this
,
0
);
m_utfsClientUploader
->
closeChannel
();
...
...
@@ -190,7 +190,7 @@ void MaemoRemoteMounter::deployUtfsClient()
this
,
SLOT
(
handleUploaderInitializationFailed
(
QString
)));
m_utfsClientUploader
->
initialize
();
m_s
tate
=
UploaderInitializing
;
setS
tate
(
UploaderInitializing
)
;
}
void
MaemoRemoteMounter
::
handleUploaderInitializationFailed
(
const
QString
&
reason
)
...
...
@@ -199,7 +199,7 @@ void MaemoRemoteMounter::handleUploaderInitializationFailed(const QString &reaso
if
(
m_state
==
UploaderInitializing
)
{
emit
error
(
tr
(
"Failed to establish SFTP connection: %1"
).
arg
(
reason
));
m_s
tate
=
Inactive
;
setS
tate
(
Inactive
)
;
}
}
...
...
@@ -218,11 +218,11 @@ void MaemoRemoteMounter::handleUploaderInitialized()
m_uploadJobId
=
m_utfsClientUploader
->
uploadFile
(
localFile
,
utfsClientOnDevice
(),
SftpOverwriteExisting
);
if
(
m_uploadJobId
==
SftpInvalidJob
)
{
m_s
tate
=
Inactive
;
setS
tate
(
Inactive
)
;
emit
error
(
tr
(
"Could not upload UTFS client (%1)."
).
arg
(
localFile
));
}
else
{
setState
(
UploadRunning
);
}
m_state
=
UploadRunning
;
}
void
MaemoRemoteMounter
::
handleUploadFinished
(
Core
::
SftpJobId
jobId
,
...
...
@@ -241,7 +241,7 @@ void MaemoRemoteMounter::handleUploadFinished(Core::SftpJobId jobId,
m_uploadJobId
=
SftpInvalidJob
;
if
(
!
errorMsg
.
isEmpty
())
{
emit
error
(
tr
(
"Could not upload UTFS client: %1"
).
arg
(
errorMsg
));
m_s
tate
=
Inactive
;
setS
tate
(
Inactive
)
;
return
;
}
...
...
@@ -285,14 +285,14 @@ void MaemoRemoteMounter::startUtfsClients()
this
,
SLOT
(
handleUtfsClientStderr
(
QByteArray
)));
m_mountProcess
->
start
();
m_s
tate
=
UtfsClientsStarting
;
setS
tate
(
UtfsClientsStarting
)
;
}
void
MaemoRemoteMounter
::
handleUtfsClientsStarted
()
{
ASSERT_STATE
(
QList
<
State
>
()
<<
UtfsClientsStarting
<<
Inactive
);
if
(
m_state
==
UtfsClientsStarting
)
{
m_s
tate
=
UtfsClientsStarted
;
setS
tate
(
UtfsClientsStarted
)
;
QTimer
::
singleShot
(
250
,
this
,
SLOT
(
startUtfsServers
()));
}
}
...
...
@@ -305,7 +305,7 @@ void MaemoRemoteMounter::handleUtfsClientsFinished(int exitStatus)
if
(
m_state
==
Inactive
)
return
;
m_s
tate
=
Inactive
;
setS
tate
(
Inactive
)
;
if
(
exitStatus
==
SshRemoteProcess
::
ExitedNormally
&&
m_mountProcess
->
exitCode
()
==
0
)
{
m_utfsServerTimer
->
stop
();
...
...
@@ -352,7 +352,7 @@ void MaemoRemoteMounter::startUtfsServers()
utfsServerProc
->
start
(
utfsServer
(),
utfsServerArgs
);
}
m_s
tate
=
UtfsServersStarted
;
setS
tate
(
UtfsServersStarted
)
;
}
void
MaemoRemoteMounter
::
handleUtfsServerStderr
()
...
...
@@ -377,10 +377,9 @@ void MaemoRemoteMounter::handleUtfsServerError(QProcess::ProcessError)
.
arg
(
QString
::
fromLocal8Bit
(
errorOutput
));
}
killAllUtfsServers
();
m_utfsServerTimer
->
stop
();
emit
error
(
tr
(
"Error running UTFS server: %1"
).
arg
(
errorString
));
m_s
tate
=
Inactive
;
setS
tate
(
Inactive
)
;
}
void
MaemoRemoteMounter
::
handleUtfsServerFinished
(
int
/* exitCode */
,
...
...
@@ -436,8 +435,9 @@ void MaemoRemoteMounter::handleUtfsServerTimeout()
killAllUtfsServers
();
emit
error
(
tr
(
"Timeout waiting for UTFS servers to connect."
));
// TODO: utfs clients are still waiting; kill them here
m_s
tate
=
Inactive
;
setS
tate
(
Inactive
)
;
}
void
MaemoRemoteMounter
::
assertState
(
State
expectedState
,
const
char
*
func
)
...
...
@@ -452,5 +452,12 @@ void MaemoRemoteMounter::assertState(const QList<State> &expectedStates,
qDebug
(
"Unexpected state %d at %s."
,
m_state
,
func
))
}
void
MaemoRemoteMounter
::
setState
(
State
newState
)
{
if
(
newState
==
Inactive
)
m_utfsServerTimer
->
stop
();
m_state
=
newState
;
}
}
// namespace Internal
}
// namespace Qt4ProjectManager
src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.h
View file @
97a56a62
...
...
@@ -95,6 +95,15 @@ private slots:
void
startUtfsServers
();
private:
enum
State
{
Inactive
,
Unmounting
,
UploaderInitializing
,
UploadRunning
,
UtfsClientsStarting
,
UtfsClientsStarted
,
UtfsServersStarted
};
void
assertState
(
State
expectedState
,
const
char
*
func
);
void
assertState
(
const
QList
<
State
>
&
expectedStates
,
const
char
*
func
);
void
setState
(
State
newState
);
void
deployUtfsClient
();
void
startUtfsClients
();
void
killUtfsServer
(
QProcess
*
proc
);
...
...
@@ -127,12 +136,6 @@ private:
QByteArray
m_umountStderr
;
MaemoPortList
m_portList
;
enum
State
{
Inactive
,
Unmounting
,
UploaderInitializing
,
UploadRunning
,
UtfsClientsStarting
,
UtfsClientsStarted
,
UtfsServersStarted
};
void
assertState
(
State
expectedState
,
const
char
*
func
);
void
assertState
(
const
QList
<
State
>
&
expectedStates
,
const
char
*
func
);
State
m_state
;
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment