zlatinb / muwire

MuWire file sharing client for I2P
GNU General Public License v3.0
191 stars 27 forks source link

[Question / Feature Request] Alternative sources for slow downloads #75

Open Searinox opened 2 years ago

Searinox commented 2 years ago

I noticed that it is possible to copy and search for files by hash. If a download is in progress and it is slow, will MuWire check for other users on the network that are sharing it and attempt to download pieces from them too?

Going into future upgrades to the download structure in order to allow for directory downloads this makes sense, because when you download a directory it doesn't have a hash and initially all the hashes of the files contained within are obtained from the one MuWire instance it's being downloaded from. If some files are particularly slow to download - either because they're big or because the host itself is slow, or even goes offline - is MuWire able to automatically search for alternate sources and start downloading from them as well?

zlatinb commented 2 years ago

Currently a new search will not add any sources to an already existing download. It is possible to make it happen, either manually or automatically. I'll probably implement manual "Find more sources" ability first. Then per-download configurable interval of how often to search for new sources. By default MuWire will not search for more sources automatically though, the user will need to explicitly configure the download. This is in order to prevent overloading the network.

MuWire relies on another mechanism called "Download Mesh" which is described in the doc/ folder in the source. The way it works is basically every pariticpant in a swarm (be it uploader or downloader) keeps track from who they have downloaded successfully at least one piece of the file. Then when someone tries to download from them they pass along information about those sources. I imagine it's similar to BitTorrent's peer discovery mechanism.

Searinox commented 2 years ago

But is it possible that a file download be simultaneously carried out from two independent sources? As in, one piece being downloaded from a user while another piece is being downloaded from another user? Sorry but I just haven't had the opportunity to experience this for myself to know.

Your solution to implement a manual search option sounds very reasonable. I've noticed that when you organize the search by file instead of user, it will show one single specific file as having multiple user sources but I haven't seen MuWire make use of those sources when I do a download. Again this could all be circumstantial for all I know, which is why I asked.

zlatinb commented 2 years ago

Yes, one piece being downloaded from one user while another piece from another user is how it works. Maybe it's not clear in the UI, but when you click on the download row in the downloads table, in the bottom of the tab in the "Download details" panel you will see "Known sources" and "Active sources" - the known sources are the total sources that MuWire thinks have the file, and active sources are the ones it currently is downloading from.