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

Add torrent.pause() API #547

Merged
merged 1 commit into from Dec 29, 2015
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -425,6 +425,15 @@ client.add(magnetUri, function (torrent) {
})
```

#### `torrent.pause()`

Temporarily stop connecting to new peers. Note that this does not pause new incoming
connections, nor does it pause the streams of existing connections or their wires.

#### `torrent.resume()`

Resume connecting to new peers.

#### `torrent.on('done', function () {})`

Emitted when all the torrent's files have been downloaded
@@ -1205,6 +1205,16 @@ Torrent.prototype.createServer = function (opts) {
return server
}

Torrent.prototype.pause = function () {
if (this.destroyed) return
this.swarm.pause()
}

Torrent.prototype.resume = function () {
if (this.destroyed) return
this.swarm.resume()
}

Torrent.prototype._onError = function (err) {
var self = this
debug('torrent error: %s', err.message || err)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.