MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / feed

Method feed

app/src/AI/SseEventReader.cpp:32–49  ·  view source on GitHub ↗

* @brief Appends a network chunk to the rolling buffer and drains complete frames. */

Source from the content-addressed store, hash-verified

30 * @brief Appends a network chunk to the rolling buffer and drains complete frames.
31 */
32void AI::SseEventReader::feed(const QByteArray& chunk)
33{
34 if (chunk.isEmpty()) {
35 drainFrames();
36 return;
37 }
38
39 if (m_buffer.size() + chunk.size() > kMaxBufferBytes) {
40 qCWarning(serialStudioAI) << "SSE buffer would exceed" << kMaxBufferBytes
41 << "bytes; dropping connection state";
42 Q_EMIT parseError(QStringLiteral("buffer_overflow"));
43 reset();
44 return;
45 }
46
47 m_buffer.append(chunk);
48 drainFrames();
49}
50
51/**
52 * @brief Discards any partially-received frame data.

Callers 6

onReplyReadyReadMethod · 0.80
onReplyFinishedMethod · 0.80
onReplyReadyReadMethod · 0.80
onReplyFinishedMethod · 0.80
onReplyReadyReadMethod · 0.80
onReplyFinishedMethod · 0.80

Calls 4

isEmptyMethod · 0.80
resetFunction · 0.50
sizeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected