pub struct LastSeenMessagesValidator {
tracked_messages: VecDeque<Option<TrackedEntry>>,
last_pending_signature: Option<Box<[u8]>>,
}Expand description
Validates that the client is properly acknowledging messages sent by the server
Fields§
§tracked_messages: VecDeque<Option<TrackedEntry>>§last_pending_signature: Option<Box<[u8]>>Implementations§
Source§impl LastSeenMessagesValidator
impl LastSeenMessagesValidator
Sourcepub fn add_pending(&mut self, signature: Option<Box<[u8]>>)
pub fn add_pending(&mut self, signature: Option<Box<[u8]>>)
Adds a pending message signature that the client should acknowledge Matches vanilla’s deduplication: only adds if different from last pending message
Sourcepub fn tracked_count(&self) -> usize
pub fn tracked_count(&self) -> usize
Gets the number of tracked messages
Sourcepub fn apply_offset(&mut self, offset: i32) -> Result<(), String>
pub fn apply_offset(&mut self, offset: i32) -> Result<(), String>
Applies an offset (removes old acknowledged messages from tracking)
Sourcepub fn apply_update(
&mut self,
acknowledged: [u8; 3],
offset: i32,
checksum: u8,
) -> Result<Vec<Box<[u8]>>, String>
pub fn apply_update( &mut self, acknowledged: [u8; 3], offset: i32, checksum: u8, ) -> Result<Vec<Box<[u8]>>, String>
Applies an acknowledgement update from the client
acknowledged: BitSet of 20 bits indicating which messages in the window are acknowledged
offset: How many old messages to remove from the window
checksum: Optional checksum for validation (0 = skip checksum)
Trait Implementations§
Source§impl Debug for LastSeenMessagesValidator
impl Debug for LastSeenMessagesValidator
Auto Trait Implementations§
impl Freeze for LastSeenMessagesValidator
impl RefUnwindSafe for LastSeenMessagesValidator
impl Send for LastSeenMessagesValidator
impl Sync for LastSeenMessagesValidator
impl Unpin for LastSeenMessagesValidator
impl UnsafeUnpin for LastSeenMessagesValidator
impl UnwindSafe for LastSeenMessagesValidator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreWraps this value in an
Arc<SyncMutex<>>