dat-push
dat-push copied to clipboard
ideas for ending an active push
Two ideas for ending active push:
- (easy) timeout after no more data is being transferred
- wait until no more want requests
Conversation in IRC:
<•jhand> mafintosh: been awhile since I went through it. But wouldn't the sparse peers only take some of the new changes?
4:20 PM Like if someone is browsing a dat website, they may download one new page but not all of them
4:21 PM <•mafintosh> Mathias Buus jhand: ah i understand what you are saying now
4:21 PM <•jhand> Joe Hand I think the last idea I had was to wait until there are no more want requests
4:21 PM <•mafintosh> Mathias Buus Timing out if prob fine
4:21 PM Yea!
4:22 PM <•jhand> Joe Hand timing out seems much easier
4:22 PM <•mafintosh> Mathias Buus jhand: we actually have a state object also that indicates if the remote is interested in downloading data
4:22 PM <•jhand> Joe Hand ah cool. ya i wasn't sure where to dig into that
4:22 PM <•mafintosh> Mathias Buus I'd do the timeout version first tho as suggested
4:22 PM That makes a ton of sense
In darp2 I checked with every client that connects if it the peer's bitfield is equal to the own bitfield to make sure that the whole thing is uploaded:
https://github.com/dotloom/darp2/blob/1f9a4ba4216e5106b0fffae0cd2374175022620a/index.js#L59-L72
After another very long night on that topic I arrived at following state: https://github.com/dotloom/darp2/blob/3ececfbf76aa3f5f5c913659d69aa48460fd71f6/util/trackUpload.js#L13-L66
I added the timeout solution for now: https://github.com/joehand/dat-push/commit/98522b7479f3225cd0960d9555748609992c3bf9