Add network link to ue-server implementation #13
@ -32,17 +32,6 @@ enum ReadingState {
|
||||
Payload,
|
||||
}
|
||||
|
||||
dkanus marked this conversation as resolved
Outdated
|
||||
pub struct MessageReader {
|
||||
is_broken: bool,
|
||||
reading_state: ReadingState,
|
||||
read_bytes: usize,
|
||||
length_buffer: [u8; 4],
|
||||
current_message_length: usize,
|
||||
current_message: Vec<u8>,
|
||||
read_messages: VecDeque<String>,
|
||||
ue_received_bytes: u64,
|
||||
}
|
||||
|
||||
/// For converting byte stream that is expected from the ue-server into actual messages.
|
||||
Ggg_123
commented
sent next message => sent this message? sent next message => sent this message?
|
||||
/// Expected format is a sequence of either:
|
||||
Ggg_123
commented
1024? Not 4096? 1024? Not 4096?
dkanus
commented
4096 is limitation on how much we can write, it's unrelated to reading and this is an arbitrary constant. Honestly I don't know what to use, but one option is to add 4096 is limitation on how much we can write, it's unrelated to reading and this is an arbitrary constant. Honestly I don't know what to use, but one option is to add `BufReader` and read byte-by-byte.
dkanus
commented
Did some tests with ue-server. As of now, buffer size does not make a difference in speed, since bottleneck is ue-server's side by far. And it's unlikely that situation will change even with multiple ue-servers connecting to Avarice. Did some tests with ue-server. As of now, buffer size does not make a difference in speed, since bottleneck is ue-server's side by far. And it's unlikely that situation will change even with multiple ue-servers connecting to Avarice.
|
||||
/// 1. [HEAD_UE_RECEIVED: marker byte | 1 byte]
|
||||
Ggg_123
commented
Confusing name, since it's not related to https://doc.rust-lang.org/std/iter/trait.Iterator.html#tymethod.next, which is very common. Confusing name, since it's not related to https://doc.rust-lang.org/std/iter/trait.Iterator.html#tymethod.next, which is very common.
|
||||
@ -54,6 +43,17 @@ pub struct MessageReader {
|
||||
/// never recovers from it.
|
||||
/// Use either `push_byte()` or `push()` to input byte stream from ue-server and `pop()` to
|
||||
dkanus marked this conversation as resolved
Outdated
Ggg_123
commented
buffer => length_buffer, since it's used only for storing length bytes buffer => length_buffer, since it's used only for storing length bytes
dkanus
commented
Agreed Agreed
|
||||
/// retrieve resulting messages.
|
||||
pub struct MessageReader {
|
||||
is_broken: bool,
|
||||
reading_state: ReadingState,
|
||||
read_bytes: usize,
|
||||
length_buffer: [u8; 4],
|
||||
current_message_length: usize,
|
||||
current_message: Vec<u8>,
|
||||
Ggg_123
commented
Maybe remove continue? Maybe remove continue?
|
||||
read_messages: VecDeque<String>,
|
||||
dkanus marked this conversation as resolved
Outdated
Ggg_123
commented
with_capactiy? with_capactiy?
Ggg_123
commented
+ // will be recreated with with_capacity in push()
|
||||
ue_received_bytes: u64,
|
||||
dkanus marked this conversation as resolved
Outdated
Ggg_123
commented
with_capactiy? with_capactiy?
|
||||
}
|
||||
|
||||
impl MessageReader {
|
||||
pub fn new() -> MessageReader {
|
||||
MessageReader {
|
||||
|
Loading…
Reference in New Issue
Block a user
Unclear meaning.
rename to ue_received_bytes