From f118767e3faddad55cdc4751f64a0c4209be7156 Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Fri, 23 Jul 2021 01:23:13 +0700 Subject: [PATCH] Rename `buffer` into `length_buffer` --- src/link/mod.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/link/mod.rs b/src/link/mod.rs index d10f93a..c58ce13 100644 --- a/src/link/mod.rs +++ b/src/link/mod.rs @@ -39,7 +39,7 @@ pub struct MessageReader { is_broken: bool, reading_state: ReadingState, read_bytes: usize, - buffer: [u8; 4], + length_buffer: [u8; 4], current_message_length: usize, current_message: Vec, read_messages: VecDeque, @@ -63,7 +63,7 @@ impl MessageReader { is_broken: false, reading_state: ReadingState::Head, read_bytes: 0, - buffer: [0; 4], + length_buffer: [0; 4], current_message_length: 0, // Will be recreated with `with_capacity` in `push_byte()` current_message: Vec::new(), @@ -88,18 +88,18 @@ impl MessageReader { } } ReadingState::ReceivedBytes => { - self.buffer[self.read_bytes] = input; + self.length_buffer[self.read_bytes] = input; self.read_bytes += 1; if self.read_bytes >= UE_RECEIVED_FIELD_SIZE { - self.ue_received_bytes += array_of_u8_to_u32(self.buffer) as u64; + self.ue_received_bytes += array_of_u8_to_u32(self.length_buffer) as u64; self.change_state(ReadingState::Head); } } ReadingState::Length => { - self.buffer[self.read_bytes] = input; + self.length_buffer[self.read_bytes] = input; self.read_bytes += 1; if self.read_bytes >= UE_LENGTH_FIELD_SIZE { - self.current_message_length = array_of_u8_to_u32(self.buffer) as usize; + self.current_message_length = array_of_u8_to_u32(self.length_buffer) as usize; self.change_state(ReadingState::Payload); if self.current_message_length > MAX_UE_MESSAGE_LENGTH { self.is_broken = true;