diff --git a/client/core/sshsession.cpp b/client/core/sshsession.cpp index 401a4ec8..6d5a6edb 100644 --- a/client/core/sshsession.cpp +++ b/client/core/sshsession.cpp @@ -21,6 +21,9 @@ namespace libssh { ssh_channel_send_eof(m_channel); } if (m_isChannelOpened) { + ssh_channel_close(m_channel); + } + if (m_isChannelCreated) { ssh_channel_free(m_channel); } if (m_isSftpInitialized) { @@ -92,6 +95,7 @@ namespace libssh { return fromLibsshErrorCode(ssh_get_error_code(m_session)); } + m_isChannelCreated = true; int result = ssh_channel_open_session(m_channel); if (result == SSH_OK && ssh_channel_is_open(m_channel)) { diff --git a/client/core/sshsession.h b/client/core/sshsession.h index 253d1ac4..b3e1199c 100644 --- a/client/core/sshsession.h +++ b/client/core/sshsession.h @@ -43,6 +43,7 @@ namespace libssh { ssh_channel m_channel; sftp_session m_sftpSession; + bool m_isChannelCreated = false; bool m_isChannelOpened = false; bool m_isSessionConnected = false; bool m_isNeedSendChannelEof = false;