pub struct FragmentAssembler { /* private fields */ }Expand description
Joins fragmented GIOP 1.1 and 1.2 messages.
Feed every complete message received on one connection to
push. Unfragmented messages are returned
as they are; a fragmented one is returned as a single message, with the
more-fragments flag cleared and the size updated, once its last
fragment arrives.
GIOP 1.1 allows one fragmented message at a time per connection. GIOP 1.2 interleaves them by request id, which is the first field of every message that can be fragmented.
The data in each Fragment is aligned relative to the start of that
Fragment message, as omniORB writes and reads it. In GIOP 1.2 the
data of a fragment starts at offset 16 and every fragment but the last
ends on an 8-byte boundary, so this is the same as aligning the joined
message. In GIOP 1.1 it is not:
omniORB ends each fragment on an 8-byte boundary and continues at
offset 12 of the next, so an 8-byte value after a fragment boundary
would be read 4 bytes off. The joined message therefore carries a
Segment for each fragment, which AssembledMessage::decode passes
on to the body decoder.
Implementations§
Source§impl FragmentAssembler
impl FragmentAssembler
Sourcepub const DEFAULT_MAX_MESSAGE_SIZE: usize
pub const DEFAULT_MAX_MESSAGE_SIZE: usize
Default limit on the size of a reassembled message: 64 MiB.
Sourcepub fn new(max_message_size: usize) -> FragmentAssembler
pub fn new(max_message_size: usize) -> FragmentAssembler
Creates an assembler that rejects reassembled messages longer than
max_message_size bytes, header included.
Sourcepub fn has_pending(&self) -> bool
pub fn has_pending(&self) -> bool
Whether any fragmented message is incomplete.
Sourcepub fn cancel(&mut self, request_id: u32) -> bool
pub fn cancel(&mut self, request_id: u32) -> bool
Drops an incomplete GIOP 1.2 message, as on a CancelRequest.
Sourcepub fn push(&mut self, msg: &[u8]) -> Result<Option<AssembledMessage>>
pub fn push(&mut self, msg: &[u8]) -> Result<Option<AssembledMessage>>
Takes one complete message and returns a whole message when one is ready.
Sourcepub fn push_owned(&mut self, msg: Vec<u8>) -> Result<Option<AssembledMessage>>
pub fn push_owned(&mut self, msg: Vec<u8>) -> Result<Option<AssembledMessage>>
Like push, but takes the buffer the message was read
into: an unfragmented message, and the first fragment of a
fragmented one, keep it instead of copying it.