Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upCustom Bittorrent extensions on nodejs stopped working after v0.81.0 #1207
Comments
This comment has been minimized.
This comment has been minimized.
|
I tried to debug this issue and i suspect that the bug may actually be with the previous version of webtorrent (0.81.0) and not with the new one. With the new version (0.98.19) if a torrent is "done" (as it is the case in the test application, since it's creating a torrent calling seed()), the peer is not added (unless it's manually added calling addPeer() on the torrent object). The check is done in the onPeer function: Line 355 in a7f8f71 If this line is commented, then the message are shown as before. As I mentioned, I suspect that this is not actually a bug, but I'd ask the assistance of @DiegoRBaquero to confirm my analysis (i've just started looking into webtorrent code yesterday) Hope it helps! Let me know if you need more details on my analysis. |
This comment has been minimized.
This comment has been minimized.
|
@gverni very good, thanks very much for taking the time to figure out exactly which bit of code is responsible! I can confirm that commenting out that line fixes the issue and the correct behaviour continues. I believe this is a bug in webtorrent because BEP 0010 which specifies this feature does not say anything about ignoring extended message connections after the torrent is done. In fact it says:
It would be good to see how other implementations handle this situation (torrent "done" but extension messages continue) but on reading the spec this seems like a bug to me. Perhaps an intermediate fix would be for extension protocol handlers to set a flag saying that they would like to continue handling connections after the torrent has finished downloading? |
This comment has been minimized.
This comment has been minimized.
|
@DiegoRBaquero after doing some testing and thinking about this some more I think that @gverni is correct that this is not a bug. If a node is seeding some content we would not expect it to make outgoing connections to other peers. I managed to solve my particular use-case by using |
Test code and instructions for replicating this bug can be found in this repository:
https://github.com/chr15m/webtorrent-extension-bug
This is the script:
https://github.com/chr15m/webtorrent-extension-bug/blob/master/wt.js
What version of WebTorrent?
webtorrent@0.81.0&webtorrent@0.98.19under node, not browser.webtorrent@0.81.0was the last version where the test extension would work as expected.What operating system and Node.js version?
node:
v8.7.0Machine 1 (local):
Linux HOSTNAME 3.19.0-80-generic #88~14.04.1-Ubuntu SMP Fri Jan 13 14:54:07 UTC 2017 x86_64 x86_64 x86_64 GNU/LinuxMachine 2 (remote):
Linux HOSTNAME 2.6.32-5-686-bigmem #1 SMP Tue May 13 16:55:48 UTC 2014 i686 GNU/LinuxWhat did you expect to happen?
The correct behaviour occurs on on
v0.81.0- the two instances of the extension protocol inwt.jsfind each other and begin exchanging messages:What actually happened?
Under the latest version
v0.98.19the two instances do not find each other and their wires do not connect: