dat-push icon indicating copy to clipboard operation
dat-push copied to clipboard

ideas for ending an active push

Open joehand opened this issue 7 years ago • 3 comments

Two ideas for ending active push:

  1. (easy) timeout after no more data is being transferred
  2. 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

joehand avatar May 15 '18 15:05 joehand

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

martinheidegger avatar Nov 03 '18 07:11 martinheidegger

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

martinheidegger avatar Dec 19 '18 11:12 martinheidegger

I added the timeout solution for now: https://github.com/joehand/dat-push/commit/98522b7479f3225cd0960d9555748609992c3bf9

pfrazee avatar Feb 12 '19 19:02 pfrazee