2020-03-14 21:53:36 +00:00
|
|
|
|
|
|
|
__ __ __
|
|
|
|
__/ // /_/ /___ _____ ____ _ __ ___ ____ __
|
|
|
|
/_ _ __/ / __ `/ __ \/ __ `/ / / / / | /| / / / / /
|
|
|
|
/_ _ __/ / /_/ / / / / /_/ / / /_/ /| |/ |/ / /_/ /
|
|
|
|
/_//_/ /_/\__,_/_/ /_/\__, / \__,_/ |__/|__/\__,_/
|
|
|
|
/____/
|
|
|
|
|
|
|
|
## High level approach
|
|
|
|
|
2020-03-14 22:17:54 +00:00
|
|
|
For this assignment we developed a new protocol that would be particularly efficient at
|
2020-03-14 22:48:35 +00:00
|
|
|
transferring a file over an unreliable connection. The protocol divides the input file
|
2020-03-14 22:17:54 +00:00
|
|
|
into fixed-length "segments", numbers them sequentially, and attempts to transfer them to
|
|
|
|
the receiver. It repeatedly retransmits segments that it is not confident that the
|
2020-03-14 22:48:35 +00:00
|
|
|
receiver has obtained. The receiver periodically sends batched-acknowledgements that
|
|
|
|
list received segments. The segments are compressed using state-of-the-art compression
|
2020-03-14 22:17:54 +00:00
|
|
|
algorithms to ensure expedient delivery. The rate of sending and acknowledgement is
|
2020-03-14 22:48:35 +00:00
|
|
|
continuously tuned to optimize for network conditions using coding and algorithms.
|
2020-03-14 21:53:36 +00:00
|
|
|
|
|
|
|
## Challenges
|
|
|
|
|
2020-03-14 22:17:54 +00:00
|
|
|
We faced many challenges implementing this protocol, such as the following:
|
|
|
|
|
|
|
|
- Learning how to use cutting-edge event-loop libraries in Rust
|
|
|
|
- Selecting a re-transmission algorithms that would be resistant to drops and duplicates
|
|
|
|
- Choosing constants that would tune the transmission rate to adjust automatically to
|
|
|
|
network latency and bandwidth
|
|
|
|
- Ensuring that *both* connections would close once the file had been successfully
|
|
|
|
transferred.
|
2020-03-14 21:53:36 +00:00
|
|
|
|
|
|
|
## Testing
|
|
|
|
|
2020-03-14 22:48:35 +00:00
|
|
|
Various internal algorithms and data structures were tested using simple unit tests. For
|
2020-03-14 22:17:54 +00:00
|
|
|
instance, we have unit tests to check that our packet encoding/decoding schemes work
|
|
|
|
correctly.
|
|
|
|
|
|
|
|
However, testing general consistency of the protocol was done by running the scripts
|
|
|
|
provided to us, which automatically adjust network conditions and send large files.
|