Exemplo n.º 1
0
int SshChannelManager::closeAllChannels(CloseAllMode mode)
{
    int count = 0;
    for (ChannelIterator it = m_channels.begin(); it != m_channels.end(); ++it) {
        AbstractSshChannel * const channel = it.value();
        QSSH_ASSERT(channel->channelState() != AbstractSshChannel::Closed);
        if (channel->channelState() != AbstractSshChannel::CloseRequested) {
            channel->closeChannel();
            ++count;
        }
    }
    if (mode == CloseAllAndReset) {
        m_channels.clear();
        m_sessions.clear();
    }
    return count;
}
Exemplo n.º 2
0
void AbstractSshChannel::closeChannel()
{
    if (m_state == CloseRequested) {
        m_timeoutTimer.stop();
    } else if (m_state != Closed) {
        if (m_state == Inactive) {
            setChannelState(Closed);
        } else {
            setChannelState(CloseRequested);
            if (m_remoteChannel != NoChannel) {
                m_sendFacility.sendChannelEofPacket(m_remoteChannel);
                m_sendFacility.sendChannelClosePacket(m_remoteChannel);
            } else {
                QSSH_ASSERT(m_state == SessionRequested);
            }
        }
    }
}
void SshRemoteProcessRunner::sendSignalToProcess(SshRemoteProcess::Signal signal)
{
    QSSH_ASSERT(isProcessRunning());
    d->m_process->sendSignal(signal);
}
void SshRemoteProcessRunner::writeDataToProcess(const QByteArray &data)
{
    QSSH_ASSERT(isProcessRunning());
    d->m_process->write(data);
}
int SshRemoteProcessRunner::processExitCode() const
{
    QSSH_ASSERT(processExitStatus() == SshRemoteProcess::NormalExit);
    return d->m_exitCode;
}
SshRemoteProcess::Signal SshRemoteProcessRunner::processExitSignal() const
{
    QSSH_ASSERT(processExitStatus() == SshRemoteProcess::CrashExit);
    return d->m_exitSignal;
}
SshRemoteProcess::ExitStatus SshRemoteProcessRunner::processExitStatus() const
{
    QSSH_ASSERT(!isProcessRunning());
    return d->m_exitStatus;
}