SshDirectTcpIpTunnelPrivate::SshDirectTcpIpTunnelPrivate(quint32 channelId, quint16 remotePort,
        const SshConnectionInfo &connectionInfo, SshSendFacility &sendFacility)
    : AbstractSshChannel(channelId, sendFacility),
      m_remotePort(remotePort),
      m_connectionInfo(connectionInfo)
{
    connect(this, SIGNAL(eof()), SLOT(handleEof()));
}
Botan::TLS::Channel::alert_cb TlsPskAdaptor::alertCallback() {
    return [this](Botan::TLS::Alert alert, const Botan::byte data[], size_t dataSize) {
        auto dataPtr = kj::ArrayPtr<const kj::byte>(reinterpret_cast<const kj::byte*>(data), dataSize);
        KJ_LOG(INFO, "TLS Alert", alert.type_string(), dataPtr, dataSize, alert.is_fatal(), alert.is_valid());
        if (alert.is_fatal())
            handleEof();
    };
}
void MplVideoPlayerBackend::createMplayerProcess()
{
    m_mplayer = new MplayerProcess(m_wid, this);
    connect(m_mplayer, SIGNAL(mplayerError(bool,QString)), this, SLOT(setError(bool,QString)));
    connect(m_mplayer, SIGNAL(eof()), this, SLOT(handleEof()));
    connect(m_mplayer, SIGNAL(readyToPlay()), this, SLOT(mplayerReady()));
    connect(m_mplayer, SIGNAL(durationChanged()), this, SLOT(durationIsKnown()));
    connect(m_mplayer, SIGNAL(currentPosition(double))
            ,this, SIGNAL(currentPosition(double)));
}
void TlsPskAdaptor::processBytes(std::vector<Botan::byte> buffer) {
    if (buffer.size() == 0)
        return handleEof();
    auto bytesNeeded = channel->received_data(kj::mv(buffer));

    if (bytesNeeded) {
        buffer.resize(bytesNeeded);
        tasks.add(stream->read(buffer.data(), buffer.size(), buffer.size()).then(
                          [this, buffer = kj::mv(buffer)](size_t bytesRead) mutable {
            buffer.resize(bytesRead);
            processBytes(kj::mv(buffer));
        }));
    } else
        startReadLoop();
}