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 upPiece not reverting to webseed if all webrtc peers go away #1666
Comments
This comment has been minimized.
This comment has been minimized.
|
Great! I was a week playing how to configure webseed, so I guess in the future this post will help me out. I’m curious to know how you configured the torrent and how did you measured you were webseeding. I tried multiple combinations, all of them using magnet links, and &xs=http://IP:PORT/Folder%20Name, as my torrent is a folder with multiple files. In other issues Feross commented you only need to webseed the .torrent, but trying different combinations I’ve seen the GET/ of files, not sure how much were downloaded as I see WebTorrent Desktop seeding in local net, and no luck using webseed out of the local net. May I ask you how you do the torrent config and webseed? There is almost 0 official info about this topic. |
This comment has been minimized.
This comment has been minimized.
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
This comment has been minimized.
This comment has been minimized.
|
Hi, I have also found this problem... Is there something plan to fix that issue? |
WebTorrent Version: 0.103.0
OS: Windows and Centos 7,
local website served using Node's "http-server"
Browser: Chrome 75 (also Firefox 67)
What was expected
I have a multi-file torrent. It has a webseed and I start with one WebRTC peer (seeded with the webseed). I then start another client which downloads some pieces from the webrtc peer and others from the webseed (as expected).
If the webrtc peer goes away I expect that eventually the pieces being sourced from the webrtc peer will get downloaded via the webseed.
What actually happened?
If I close the tab with the WebRTC peer (effectively leaving only the webseed active) then the pieces which using the webrtc seed never switch over to the webseed. So some files never get downloaded.
I see that there is different logic for webseeds and webrtc in the _request() function of torrent.js concerning how a piece is allocated. These functions are defined in torrent-piece (https://github.com/webtorrent/torrent-piece/blob/master/index.js)
If I am reading that code correctly, once chunks are allocated for webrtc these will never be served by a webseed. Even when a peer dies leaving no webrtc sources the internal fields, _reservations and _cancellations, are not reset.
What I tried
I added a hack in _request() before the call to piece.reserve()/piece.reserveRemaining(). I reset piece._reservations and piece._cancellations if piece._cancellations is populated and there are no webrtc sources.
With this change webtorrent works as expected. The download pauses briefly as expected when my webrtc peer dies, then my change resets the piece on the next _request() call and the piece downloads using the webseed.
So have I found a bug, or am I using/configuring webtorrent incorrectly?