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
358890c2
Commit
358890c2
authored
Aug 16, 2010
by
ck
Browse files
SSH: Don't use socket if it's in an unhealthy state.
parent
b639a6e7
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/plugins/coreplugin/ssh/sshconnection.cpp
View file @
358890c2
...
...
@@ -241,6 +241,8 @@ void SshConnectionPrivate::handleIncomingData()
return
;
// For stuff queued in the event loop after we've called closeConnection();
try
{
if
(
!
canUseSocket
())
return
;
m_incomingData
+=
m_socket
->
readAll
();
#ifdef CREATOR_SSH_DEBUG
qDebug
(
"state = %d, remote data size = %d"
,
m_state
,
...
...
@@ -478,7 +480,8 @@ void SshConnectionPrivate::handleDisconnect()
void
SshConnectionPrivate
::
sendData
(
const
QByteArray
&
data
)
{
m_socket
->
write
(
data
);
if
(
canUseSocket
())
m_socket
->
write
(
data
);
}
void
SshConnectionPrivate
::
handleSocketDisconnected
()
...
...
@@ -543,10 +546,17 @@ void SshConnectionPrivate::closeConnection(SshErrorCode sshError,
emit
error
(
userError
);
if
(
m_state
==
ConnectionEstablished
)
emit
disconnected
();
m_socket
->
disconnectFromHost
();
if
(
canUseSocket
())
m_socket
->
disconnectFromHost
();
m_state
=
SocketUnconnected
;
}
bool
SshConnectionPrivate
::
canUseSocket
()
const
{
return
m_socket
->
isValid
()
&&
m_socket
->
state
()
==
QAbstractSocket
::
ConnectedState
;
}
QSharedPointer
<
SshRemoteProcess
>
SshConnectionPrivate
::
createRemoteProcess
(
const
QByteArray
&
command
)
{
return
m_channelManager
->
createRemoteProcess
(
command
);
...
...
src/plugins/coreplugin/ssh/sshconnection_p.h
View file @
358890c2
...
...
@@ -124,6 +124,7 @@ private:
void
handleChannelEof
();
void
handleChannelClose
();
void
handleDisconnect
();
bool
canUseSocket
()
const
;
void
sendData
(
const
QByteArray
&
data
);
...
...
src/plugins/coreplugin/ssh/sshsendfacility.cpp
View file @
358890c2
...
...
@@ -48,8 +48,11 @@ void SshSendFacility::sendPacket()
#ifdef CREATOR_SSH_DEBUG
qDebug
(
"Sending packet, client seq nr is %u"
,
m_clientSeqNr
);
#endif
m_socket
->
write
(
m_outgoingPacket
.
rawData
());
++
m_clientSeqNr
;
if
(
m_socket
->
isValid
()
&&
m_socket
->
state
()
==
QAbstractSocket
::
ConnectedState
)
{
m_socket
->
write
(
m_outgoingPacket
.
rawData
());
++
m_clientSeqNr
;
}
}
void
SshSendFacility
::
reset
()
...
...
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