Add network link to ue-server implementation #13
@ -20,6 +20,9 @@ const HEAD_UE_MESSAGE: u8 = 42;
|
||||
// Maximum allowed size of JSON message sent from ue-server.
|
||||
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;
|
||||
dkanus marked this conversation as resolved
Outdated
|
||||
|
||||
custom_error! { pub ReadingStreamError
|
||||
Ggg_123
commented
Can be simplified => // Listen to new connections Can be simplified => // Listen to new connections
|
||||
InvalidHead{input: u8} = "Invalid byte used as a HEAD: {input}",
|
||||
Ggg_123 marked this conversation as resolved
Ggg_123
commented
Probably needs a timeout, to avoid waiting forever: Probably needs a timeout, to avoid waiting forever:
stream
.set_read_timeout(Some(Duration::from_secs(5)))
.unwrap();
|
||||
MessageTooLong{length: usize} = "Message to receive is too long: {length}",
|
||||
@ -63,8 +66,9 @@ impl MessageReader {
|
||||
reading_state: ReadingState::Head,
|
||||
read_bytes: 0,
|
||||
current_message_length: 0,
|
||||
// Will be recreated with `with_capacity` in `push_byte()`
|
||||
Ggg_123
commented
Why? Why?
|
||||
current_message: Vec::new(),
|
||||
read_messages: VecDeque::new(),
|
||||
read_messages: VecDeque::with_capacity(EXPECTED_LIMIT_TO_UE_MESSAGES),
|
||||
next_received_bytes: 0,
|
||||
received_bytes: 0,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user
with_capacity != limit.
Should it really be a constant?
I'd just inline it.
It is expected limit that we use as a capacity.
But upon further consideration I agree that there is no sense in defining this as a constant.