Rabbit Remote Control 0.0.30
Loading...
Searching...
No Matches
OutStreamChannel.cpp
1#include "OutStreamChannel.h"
2
3#include <stdexcept>
4#include <QLoggingCategory>
5
6Q_DECLARE_LOGGING_CATEGORY(VncStreamChannel)
7
8COutStreamChannel::COutStreamChannel(CChannel* pDataChannel)
9 : rdr::BufferedOutStream(),
10 m_pDataChannel(pDataChannel)
11{
12}
13
14bool COutStreamChannel::flushBuffer()
15{
16 //Q_ASSERT(m_pDataChannel);
17 if(!m_pDataChannel || !m_pDataChannel->isOpen()) return false;
18 qint64 n = m_pDataChannel->write((const char*)sentUpTo, ptr - sentUpTo);
19
20 if (0 == n)
21 return false;
22
23 if(-1 == n)
24 {
25 qCritical(VncStreamChannel) << "COutStreamDataChannel::fillBuffer:"
26 << m_pDataChannel->errorString();
27 return false;
28 throw std::runtime_error(m_pDataChannel->errorString().toStdString());
29 }
30
31 sentUpTo += n;
32
33 return true;
34}
The channel interface class.
Definition Channel.h:25