Open glblduh opened 2 years ago
How do you currently do it? You could collect the piece states for all pieces that are in a file and calculate their byte contributions and sum them up? Does that sound right?
It can be the for the entire torrent. Like a method of the Torrent struct that outputs the current calculated download speed.
I currently do it with a concurrent function that infinitely iterates through all of the torrents to calculate its download and upload speed.
Ah yeah I mean how are you calculating speeds per File? I would prefer not to encode speed into the client itself, it should be relatively straight forward to calculate from the piece states and bytes per piece for each file, and calculating the difference since the last calculation for each File (or Torrent etc.). I would be okay with putting some helpers for doing it somewhere in the module.
I think the completed bytes of each file can be used for calculation, but I haven't tried it.
Can this feature be added to remove the need to calculate the speed in the application itself. This will be beneficial for many torrents because it removes the need to calculate for the download speed in each file in each torrents.