Rabbit Remote Control 0.0.30
Loading...
Searching...
No Matches
InStreamChannel.cpp
1#include "InStreamChannel.h"
2#include <stdexcept>
3#include <QLoggingCategory>
4
5Q_LOGGING_CATEGORY(VncStreamChannel, "VNC.Stream.Channel")
6
8 : rdr::BufferedInStream(),
9 m_pDataChannel(pDataChannel)
10{
11}
12
13bool CInStreamChannel::fillBuffer()
14{
15 //Q_ASSERT(m_pDataChannel);
16 if(!m_pDataChannel || !m_pDataChannel->isOpen()) return false;
17
18 size_t nLen = availSpace();
19 if(nLen <= 0)
20 return false;
21
22 qint64 n = m_pDataChannel->read((char*)end, nLen);
23 if (0 == n)
24 return false;
25
26 if(0 > n)
27 {
28 qCritical(VncStreamChannel) << "CInStreamDataChannel::fillBuffer:"
29 << m_pDataChannel->errorString();
30 //return false;
31 throw std::runtime_error(m_pDataChannel->errorString().toStdString());
32 }
33
34 end += n;
35
36 return true;
37}
The channel interface class.
Definition Channel.h:25