gabrieldemian / vincenzo

A BitTorrent client with vim-like keybindings and a terminal based UI.
https://github.com/gabrieldemian/vincenzo
MIT License
144 stars 7 forks source link

Generate block_infos on request, and not all upfront #10

Open gabrieldemian opened 1 year ago

gabrieldemian commented 1 year ago

When a new torrent is added to the Disk, it generates all the BlockInfos upfront, and this consumes some memory.

Those blocks should be generated dynamically when the peers request new blocks to the Disk, this would drastically reduce the amount of memory consumed.

Also, this would eliminate the need of using the crate decurse.