Skip to content

Improvements to the in-game file downloader

LJ Sonic requested to merge better-download into next

This is an upgrade to the file transfer code, mainly intended to make it more efficient for clients with "high" latency to the server (100ms or more).

Unlike the current file transfer code, which relies on the built-in packet acknowledgement system SRB2 normally uses, which uses a very small receive window and thus is very bad at handling high latencies, this new version instead uses its own acknowledgment system, more suitable for file transmission.

As a bonus, this adds a basic feature that lets you resume the previous transfer, provided you didn't close the game or try to download another file.

As another bonus, this adds a downloads command, which lets the host see the list of ongoing transfers:

$downloads 
 2  HugeFile1.wad  10657K/42066K (25%)  123.456.789.idk:5029
 4  HugeFile3.wad  1489K/4067K (36%)  192.0.0.254:5030

Also this fixes a rare bug where using io.read multiple times in a row could crash a client.

Edited by LJ Sonic

Merge request reports