SSH: Delay channel close request to server in SessionRequested state.

If closeChannel() is called in between our channel open request to the
server and the corresponding reply, we cannot forward the close request
to the server, as we don't have its channel id yet. So wait until we do.

Our failure to correctly handle this sequence of events was the root cause
for the following user-visible errors:
    - A (since-removed) Q_ASSERT in ~SshRemoteProcess() was hit.
    - The server closed the connection because we referred to an invalid
      channel ("Received ieof for nonexistent channel -1").

Commits 26920307f0 and 3027bcc952 are also related to this issue.

Change-Id: I4994d85f5b21a72682f75389cdf8769738bd6768
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
Christian Kandeler
2014-11-27 09:17:21 +01:00
committed by hjk
parent 0ef06c7523
commit 8881910565
2 changed files with 15 additions and 6 deletions

View File

@@ -31,6 +31,7 @@
#include "sshremoteprocess.h"
#include "sshremoteprocess_p.h"
#include "ssh_global.h"
#include "sshincomingpacket_p.h"
#include "sshsendfacility_p.h"
@@ -85,6 +86,7 @@ SshRemoteProcess::SshRemoteProcess(quint32 channelId, Internal::SshSendFacility
SshRemoteProcess::~SshRemoteProcess()
{
QSSH_ASSERT(d->channelState() != Internal::AbstractSshChannel::SessionEstablished);
close();
delete d;
}