qb  2.0.0.0
C++17 Actor Framework
qb Issue Watch Star Fork Follow @isndev
Loading...
Searching...
No Matches
qb::io::async::event::pending_read Struct Reference

Event triggered when unprocessed data remains in the input buffer after protocol processing. More...

#include <pending_read.h>

Public Attributes

std::size_t bytes
 Number of unprocessed bytes remaining in the read buffer after successful protocol message extraction.

Detailed Description

Event triggered when unprocessed data remains in the input buffer after protocol processing.

This event is passed to the derived class's on(qb::io::async::event::pending_read&&) method by some asynchronous input components (like qb::io::async::input or qb::io::async::io) to inform that after one or more messages were parsed by the protocol, there are still bytes remaining in the input buffer. This usually indicates a partial next message.

This event is typically informational. The remaining data will stay in the buffer to be combined with subsequent reads. It can be useful for monitoring buffer states or for protocols that might need to take action based on partially received data.

Usage Example:

class MyProtocolHandler : public qb::io::async::input<MyProtocolHandler> {
public:
// ... protocol definition and on(ProtocolMessage&) handler ...
void on(qb::io::async::event::pending_read &&event) {
LOG_DEBUG("Pending read data: " << event.bytes << " bytes remaining in input buffer.");
// Typically no action is needed here as the data remains for the next read cycle.
// However, one might implement logic for very large partial messages if necessary.
}
};
CRTP base class for managing asynchronous input operations with protocol processing.
Definition io.h:517
#define LOG_DEBUG(X)
Debug-level log macro (no-op if QB_STDOUT_LOG is not defined)
Definition io.h:215