-
-
Notifications
You must be signed in to change notification settings - Fork 625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow stopping/pausing torrents #155
Comments
What would you want pause and stop to do? In particular, what impact should they have on network activity, downloading/uploading, fetching of info if it's not present, DHT activity, torrent Reader reading, scraping/tracking etc? |
Should completely stop all network activity and close file descriptors if any. Basically everything There is also a matter of exporting some more information and methods - when adding features I also encountered some other missing stuff (or stuff I failed to do otherwise?). I added all this but it's very bad, wonky code that doesn't always work properly and I still didn't find out why.
For starters pause/stop function is the most important. I even noticed some of the torrent clients linked from your README also had this problem # |
What's the difference between pause and stop? When would you use them? Do you have anything to add @axet and @arranlomas? |
I was thinking of them being the same, just different wording, but now I have idea how they could be different: stop would stop all network activity, close files etc, pause could keep the peers/seeds data and keep pinging trackers/dht (but not upload/download anything). Restarting from pause would be faster then. But this is just something extra and nothing critical. Either is fine, but I think one of them is pretty critical functionality. |
@anacrolix I think, here will be more and more people asking what is already done in https://gitlab.com/axet/libtorrent. In my library I decide to remove and re add torrents, to keep runtime sane. Pause a torrent may need additionals notify calls or so... @anacrolix maybe if you rework your original code and add more torrent state control, here will be more peace at the end :) |
There definitely seems to be some desire for it, but I want to be sure what is gained, other than peace of mind for some users and some minor interface changes. @jpillora ? |
Hey Matt, this feature would indeed be nice. I currently do the same as @axet, internally start and stop is implemented by adding and removing torrents. Having pause and/or stop built into |
Still chasing though, what is it that you need from pause/stop? Ceasing network activity? Killing all connections? |
It's mostly about not having to track, remove, re-add torrents. However, for me, I think killing all connections of a torrent (stop) is more useful than ceasing network activity, which I assume to mean: don't send/receive to/from current connections (pause). |
I think an important part of this is to know how expensive it is to re-add torrents that are stopped, is keeping peers worth it if it's stopped (paused) for more than a couple of seconds? With regards to tracking the state of a torrent isn't it the same whether it's stopped or paused? Would you want stop to do some kind of cleaning up? Or do you mean the client holds on to the torrent and you call pause and it doesn't drop the torrent? Could an example be like a download from chrome. Pause stops the download and maintains peers. Stop would effectively cancel? Cleanup the torrent file and any related data? However, as far as I'm aware and can tell other clients don't differentiate between pause and stop both effectively do the same a drop? |
One problem with removing/readding torrent is, from what I saw, is that added torrent is not stopped but in a weird state where it doesn't download (before Other clients do differentiate: utorrent and rtorrent stop torrent completely and notify tracker, but in paused state it retains idle connections with peers and still scrapes the tracker. It would be luxury to have both. |
Could you describe that more? Do you mean after you Drop a Torrent, it continues to function in some way? |
I might take some inspiration from recent criticisms of arbitrary labelling of things, like levelled logging, and add very specific methods like {Cease,Pause,Resume}Networking. That seems to be the main one this issue covers. If you also want forced reannounces, submit another issue for that and I'll add something like Torrent.AnnounceNow. |
Will it send announces when you Thank you very much for looking into it. For now I'll be very happy with the networking options When I drop the torrent it disappears, as it should. But when I add torrent that has some data downloaded, and not call |
Well currently the Torrent currently announces periodically. The spec seems to suggest that the started event be sent when downloading begins, and stopped when it ceases, so I guess it's appropriate to send those when networking is paused/resumed. |
I have been thinking of this issue after time passed. I'd have these methods in Torrent: Start/Stop (or maybe name something like Halt), Unpause/Pause, Add/Drop (we do have the last ones). So in this case:
Why Pause is better - allows faster speed gain when unpaused. Maybe we can make a simple if in the mail read/write loop to skip specific activities but leave the torrent working? Or some kind of a channel, waiting for Start/Unpause. Not sure about the place in the code to add that. |
I'm intending to progress on this to fix #377. Specifically in that issue, downloading of data needs to cease until the disk situation is fixed, so I'll start there. I'm thinking of |
Most of my changes to 'torrent' is about start / stop feature. Is it not much code, you can see it on a top rebased commit. Just ignore changes on 't.go' most of them - additional peeks and methods: Yet, some code lost because scrappers no longer has 'stop' method and nobody stopping dht servers. If you write your own code, I will rebase my changes. Also, to better understanding what is alive and what is dead I nil vars, it helps debug half open connection better. |
See #377 (comment). |
When writing my poor and dirty client I encountered a serious problem: your library by default is not able to stop/pause torrents, only remove them with
Drop()
method. I was able to overcome this by exporting close method and adding additional bit of code and calling it beforeDownloadAll()
, and while it seems to work, I am certain this could be done better, and some torrents sometimes do not want to start again - are stuck at 0 peers/seeds.So, let it be feature request: Please let us stop torrents in a sane, supported way.
Thanks for the great lib btw.
The text was updated successfully, but these errors were encountered: