-
-
Notifications
You must be signed in to change notification settings - Fork 227
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
resume the swarm and restart peer discovery on interested #117
base: master
Are you sure you want to change the base?
Conversation
Since making the changes to I still think both these pull requests are necessary, but thought I should also mention this as it could be helpful information.
Could this be unrelated? Is there any reason why the peers wouldn't disconnect? (maybe they are seedboxes?) But selecting a new file does do what it's supposed to. (discovers more peers / reconnects to old ones) |
Peers not disconnecting was unrelated, I checked more torrents in the meanwhile. There are some peers that always stay connected even when all others are disconnected. It was just a coincidence that all 6 peers in that test didn't disconnect as they should. |
I'm having similar problems. After partially streaming a torrent and closing the read stream, the peers disconnect and are not reconnected once the createReadStream() function is called.
However, when using peerflix-server, engine.select is called multiple times when starting up a stream and you might not want to run discovery.restart multiple times? So there probably is a better way to do this, but It works for me so far. |
@Miyou That is exactly what this pull request and this one: mafintosh/peer-wire-swarm#15 do. They just need to be merged into the repos, and also this line should be removed from It's been 20 days though, I have no idea why they haven't been merged yet. |
@jaruba Problem is wires are only reconnected if the swarm is currently paused when the engine becomes interested. When using peerflix-server the swarm isn't paused when you end a stream and so the wires don't reconnect when you start the stream back up again. So either run swarm.pause() in eos() or remove the check for the swarm being paused? |
Are you referring to a situation in which you need to restart peer discovery in order to continue downloading the same file? ie: You have watched 10%, downloaded 30%, closed the laptop lid, went out for 10 hours, then came back and tried to continue watching? And that obviously might not work because all the peers you've used in your previous session have disconnected now? |
Truth be told, these 2 PR's are only a hackish solution to one very specific problem that I've been having since the very start of using While investigating this I've seen a lot of behavior that I cannot fully explain.. The first problem is obviously with the trackers (the reason The second problem is with the wire swarm, I don't think the peers should ever time out, and I don't think there is any reason to block them from ever reconnecting naturally again. I've seen peers stay connected for days when I've already finished downloading and other peers that I've downloaded from with the highest speed disconnect for no reason (then We should not assume a normal behavior from peers as if they would only disconnect if they have nothing else to send. Users may restart their computers, pause seeding for a while, isp dropped, etc. I think the correct approach would be to attempt to reconnect back to older seeds periodically instead of disconnecting them and putting them on a black list. If this would be handled correctly |
@jaruba Yes, that is exactly what I mean. Peers disconnect after not streaming for an hour or so, so they need to be reconnected once the stream is created again. |
@Miyou It is not the only situation where this is needed, on poor health torrents you might loose a very important peer because he timed out but can become active again (without pausing streaming at all). As yet another hackish solution for it, in Powder Player I save the timestamp of the last downloaded piece and check the timestamp on a 1 minute interval, if nothing was downloaded in 1 minute or more or there are very low peers it does:
This fixes both your scenario and also partially the one I just described (as peers may be lost but the torrent still download very slowly), but is just to ugly imo to push to |
based on discussion in #116