|
Slick Sim 0.10.1
Exchange simulator that shadows real venues for risk-free strategy testing
|
Cuts each connection's control-port byte stream into whole messages, keeping the part of a message that has arrived until the rest does. More...
#include <common/control_stream.hpp>
Public Member Functions | |
| ControlStreams (size_t max_length) noexcept | |
| max_length is the longest message the server accepts. | |
| template<typename OnMessage> | |
| bool | feed (int connection, const uint8_t *data, size_t size, OnMessage &&on_message) |
| Hands on_message(const ControlHeader &, const uint8_t *message) every whole message data completes, header included, in order. | |
| void | erase (int connection) |
Cuts each connection's control-port byte stream into whole messages, keeping the part of a message that has arrived until the rest does.
For a TCP server that speaks the ControlHeader framing. Server thread only.
Definition at line 15 of file control_stream.hpp.
|
inlineexplicitnoexcept |
max_length is the longest message the server accepts.
A longer header is refused as soon as it arrives rather than buffered for.
Definition at line 19 of file control_stream.hpp.
|
inline |
Definition at line 48 of file control_stream.hpp.
|
inline |
Hands on_message(const ControlHeader &, const uint8_t *message) every whole message data completes, header included, in order.
False when the stream is malformed (a length out of range, or on_message returned false), and the caller should close the connection.
Definition at line 26 of file control_stream.hpp.