Add network link to ue-server implementation #13

Open
dkanus wants to merge 23 commits from feature_link into master
Showing only changes of commit b187041d9e - Show all commits

View File

@ -32,17 +32,6 @@ enum ReadingState {
Payload,
}
dkanus marked this conversation as resolved Outdated

Unclear meaning.

Unclear meaning.

rename to ue_received_bytes

rename to ue_received_bytes
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.
Review

sent next message => sent this message?

sent next message => sent this message?
/// Expected format is a sequence of either:

1024? Not 4096?

1024? Not 4096?

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.

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.

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]
Review

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

buffer => length_buffer, since it's used only for storing length bytes

buffer => length_buffer, since it's used only for storing length bytes

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>,
Review

Maybe remove continue?

Maybe remove continue?
read_messages: VecDeque<String>,
dkanus marked this conversation as resolved Outdated

with_capactiy?

with_capactiy?
  • // will be recreated with with_capacity in push()
+ // will be recreated with with_capacity in push()
ue_received_bytes: u64,
dkanus marked this conversation as resolved Outdated

with_capactiy?

with_capactiy?
}
impl MessageReader {
pub fn new() -> MessageReader {
MessageReader {