|
|
@ -18,9 +18,6 @@ const HEAD_UE_MESSAGE: u8 = 42; |
|
|
|
// Maximum allowed size of JSON message sent from ue-server.
|
|
|
|
// Maximum allowed size of JSON message sent from ue-server.
|
|
|
|
const MAX_UE_MESSAGE_LENGTH: usize = 25 * 1024 * 1024; |
|
|
|
const MAX_UE_MESSAGE_LENGTH: usize = 25 * 1024 * 1024; |
|
|
|
|
|
|
|
|
|
|
|
// We do not expect to receive more that this much messages at once from ue-server
|
|
|
|
|
|
|
|
const EXPECTED_LIMIT_TO_UE_MESSAGES: usize = 100; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
custom_error! { pub ReadingStreamError |
|
|
|
custom_error! { pub ReadingStreamError |
|
|
|
InvalidHead{input: u8} = "Invalid byte used as a HEAD: {input}", |
|
|
|
InvalidHead{input: u8} = "Invalid byte used as a HEAD: {input}", |
|
|
|
MessageTooLong{length: usize} = "Message to receive is too long: {length}", |
|
|
|
MessageTooLong{length: usize} = "Message to receive is too long: {length}", |
|
|
@ -67,7 +64,8 @@ impl MessageReader { |
|
|
|
current_message_length: 0, |
|
|
|
current_message_length: 0, |
|
|
|
// Will be recreated with `with_capacity` in `push_byte()`
|
|
|
|
// Will be recreated with `with_capacity` in `push_byte()`
|
|
|
|
current_message: Vec::new(), |
|
|
|
current_message: Vec::new(), |
|
|
|
read_messages: VecDeque::with_capacity(EXPECTED_LIMIT_TO_UE_MESSAGES), |
|
|
|
// This value should be more than enough for typical use
|
|
|
|
|
|
|
|
read_messages: VecDeque::with_capacity(100), |
|
|
|
ue_received_bytes: 0, |
|
|
|
ue_received_bytes: 0, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|