Open jaruba opened 9 years ago
I can confirm that there is a need for swarm.reconnectAll()
to be exposed outside this particular issue, in one of my tests on poor health torrents, one torrent in particular went from 4 to 2 peers when the file was 50% downloaded.
One of the disconnected peers was the one I was primarily downloading from with the highest speed. Manually executing swarm.reconnectAll()
in this scenario reconnected to the 2 missing peers successfully and the torrent continued to download with it's normal speed.
I have experienced this issue before, although I am still uncertain what causes the peers to disconnect in mid-download. And I know that at least @watdafox mentioned this happens in Popcorn Time too as stated in this comment: https://github.com/mafintosh/peerflix/issues/189#issuecomment-77709737
This would not fix the secondary issue of disconnecting peers but would give the possibility of a clean workaround when it happens.
@jaruba, some()
effectively evaluates your function in loop and stops when you return truthy
. Otherwise it keeps going.
As mentioned on https://github.com/mafintosh/peerflix/issues/203
Fixes reconnecting to wires in
swarm.resume()
and adds theswarm.reconnectAll()
method.