Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow for progress on write #1788

Open
wants to merge 3 commits into
base: master
from
Open
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

fix bot issues

  • Loading branch information
ftreesmilo committed Dec 10, 2019
commit 818b01501d01dcc677f1ae610b601a4c8a87932a
@@ -114,7 +114,7 @@ class Torrent extends EventEmitter {
this._servers = []
this._xsRequests = []

this._writeCb = opts.writeCb,
this._writeCb = opts.writeCb

// TODO: remove this and expose a hook instead
// optimization: don't recheck every file if it hasn't changed
@@ -1602,7 +1602,10 @@ class Torrent extends EventEmitter {
let read = 0;
const writable = new ChunkStoreWriteStream(this.store, this.pieceLength)
if (this._writeCb) {
writable._blockstream.on('data', data => this._writeCb(this.length, read += data.length))
writable._blockstream.on('data', data => {
read += data.length
this._writeCb(this.length, read)
})
}

pump(readable, writable, err => {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.