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

Fix cleanup DHT tables cache on torrent removal #1289

Open
wants to merge 5 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 continue downloading after reopening store files

  • Loading branch information
DEgITx committed Sep 25, 2018
commit dd0d0568e342ff2be6ab38c506df6dd64c2b2a2e
@@ -31,6 +31,8 @@ var uniq = require('uniq')
var utMetadata = require('ut_metadata')
var utPex = require('ut_pex') // browser exclude
var parseRange = require('parse-numeric-range')
var thunky = require('thunky')
var raf = require('random-access-file')

var File = require('./file')
var Peer = require('./peer')
@@ -1602,21 +1604,24 @@ Torrent.prototype._checkDone = function () {
}
if (!done) break
}
if (!self.done && done) {
if (done) {
const done = () => {
self.done = true
self.done = true
self._debug('torrent done: ' + self.infoHash)
self.emit('done')
}
// flush files to be able to open after download finish
if(self._store === FSChunkStore)
{
let tasks = self.store.store.files.map(function (file) {
let tasks = self.store.store.files.map(function (storeFile) {
return function (cb) {
file.open(function (err, file) {
storeFile.open(function (err, file) {
// an open error is okay because that means the file is not open
if (err) return cb(null)
file.close(cb)
file.close(() => {
storeFile.open = thunky((cb) => cb(null, raf(storeFile.path)))
cb()
})
})
}
})
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.