| 239 | } |
| 240 | |
| 241 | void DaemonClient::onDataReceived(const BytesView& bytes) { |
| 242 | // onDataReceived is called on a raw TCP connection, we need to maintain a buffer |
| 243 | { |
| 244 | std::lock_guard<Mutex> lock(_mutex); |
| 245 | _packetStream.write(bytes); |
| 246 | } |
| 247 | |
| 248 | while (consumeBufferedData()) { |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | bool DaemonClient::consumeBufferedData() { |
| 253 | Result<BytesView> result; |