Skip to main content

Module mllp_async

Module mllp_async 

Source
Expand description

Async MLLP framing, for a listener that serves many senders at once.

[crate::mllp::MllpFormatter::read_frame] reads a byte at a time from a blocking std::io::Read, which is fine for a client sending one message and wrong for a listener: it holds a thread per connection and cannot be cancelled, so one sender that opens a socket and stops writing occupies that thread until the process restarts.

This reader is cancel-safe (a timeout around it drops cleanly), buffers rather than syscalling per byte, and refuses a frame past MAX_FRAME_BYTES instead of growing until the host runs out of memory.

Enums§

FrameEnd
Why a frame read ended.

Constants§

MAX_FRAME_BYTES
Largest message this listener accepts, in bytes.

Functions§

encode_frame
Wraps payload in <SB>/<EB><CR>.
read_frame
Reads one MLLP frame from reader.