Add network link to ue-server implementation #13

Open
dkanus wants to merge 23 commits from feature_link into master

23 Commits

Author SHA1 Message Date
cfe680d770 Refactor link module for use in one thread
While `link` module is still spawning new threads to handle new
connections and reading data from connected clients - it now collects
all the received messages in one thread, simplifying their handling.
2021-08-04 04:29:20 +07:00
a6ac0b7a17 Change MessageWriter's protocol
There is no need to send length of each data chunk. This patch
simplifies protocol by only sending length of each message.
2021-07-29 17:41:28 +07:00
g
4f67a7b72c fix docs 2021-07-24 14:40:32 +07:00
26b7d1dd91 Add network prototype
This prototype is untested, since there is currently no client to test it with.

Related to #2
2021-07-24 04:46:19 +07:00
65ef791f00 Fix clippy warnings 2021-07-24 02:36:39 +07:00
034b7860d6 Refactor MessageWriter 2021-07-24 02:26:43 +07:00
5bfdd61248 Add MessageWriter implementation
This is WIP implementation, buggy, untested and not properly commented
2021-07-23 05:53:26 +07:00
f310febe62 Add new mod.rs file with for link module 2021-07-23 02:38:36 +07:00
816454f4cf Move MessageReader into a separate file 2021-07-23 02:36:05 +07:00
b187041d9e Move documentation for MessageReader 2021-07-23 02:02:05 +07:00
3f660f54d5 Remove EXPECTED_LIMIT_TO_UE_MESSAGES constant 2021-07-23 02:01:17 +07:00
5ce511c5a7 Refactor main.rs to use if let construction 2021-07-23 01:50:47 +07:00
978a5c4182 Change UE_RECEIVED_FIELD_SIZE to 2
ue-server is only supposed to receive up to 4095 bytes at once and is
expected to report after reading them, therefore 4 bytes for the amount
of received bytes is excessive and 2 will suffice.
2021-07-23 01:48:42 +07:00
e3f554218a Refactor push_byte's code
Move logic below error checking with early exit.
2021-07-23 01:31:40 +07:00
9ca00c5b8c Refactor tests for clarity 2021-07-23 01:28:33 +07:00
f118767e3f Rename buffer into length_buffer 2021-07-23 01:23:13 +07:00
202fa39a42 Fix comments for some MessageReader contants 2021-07-23 01:22:29 +07:00
bb1f73a755 Change character byte definitions into b'X' form 2021-07-22 18:54:12 +07:00
af3341c1e7 Refactor MessageReader for clarity
Rename `received_bytes` into `ue_received_bytes` and get rid of
`next_received_bytes` by reading relevant data into new byte buffer
instead.
2021-07-22 18:48:09 +07:00
0dedd1d1f1 Change MessageReader to use with_capacity
Some of the collections inside `MessageReader` were created with `new()`
instead of `with_capacity()` call. This patch fixes that or comments why
it was not done in some places.
2021-07-22 18:18:29 +07:00
b846fcf55b Fix MessageReader documentation 2021-07-22 18:11:44 +07:00
ba3ac088dd Refactor numeric constants for MessageReader 2021-07-22 18:03:48 +07:00
0a86852197 Add MessageReader implementation
I've decided that it would be a good idea to separete
compoments that transform text messages into byte chunks to send to
Unreal Engine and back. This means that each of them will have only one
responsibility and using them will be easier in case we decide to read
and write via tcp/ip in separate threads. The only interesting to them
both parameter is the amount of bytes that were confirmed to be received
from the Unreal Engine side, which can be easily shared "by hand".

This patch implements "reader" that accepts byte stream expected from
the game server and converts it into:
1. separate string messages;
2. amount of bytes game server reported to already have received.
2021-07-21 03:40:29 +07:00