client
client copied to clipboard
Code talking to the server is duplicated multiple times
The protocol we use to communicate with FAF server is very simple - sequences of 4-byte ints signifying length and data of that length. The logic that reads and writes that data, however, is duplicated a couple times around the codebase (grepping blockSize shows it very well).
We should have a single implementation that communicates its state changes and passes read blocks to a handler - possibly not even concerning itself with connecting / disconnecting the socket. Before that we need to factor out all uses of the logic from the classes that use it.