Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorArnaldas Augutis <info@untitled.lt>2018-11-22 16:38:05 +0300
committerArnaldas Augutis <info@untitled.lt>2019-06-12 00:43:47 +0300
commit5dc293f857ddd333afbc5ec52053e7ad07bf58a0 (patch)
tree937c8a4700247ce2c47c4e04c7931a835414bdf5 /lib
parent144812c09316d9016a87d6a8e5096ddb7fbf5f63 (diff)
ability to close and restore streamin server
Diffstat (limited to 'lib')
-rw-r--r--lib/server.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/server.js b/lib/server.js
index 2988f27..cc8bd88 100644
--- a/lib/server.js
+++ b/lib/server.js
@@ -15,11 +15,11 @@ function Server (torrent, opts = {}) {
const _listen = server.listen
const _close = server.close
- server.listen = port => {
+ server.listen = (...args) => {
closed = false
server.on('connection', onConnection)
server.on('request', onRequest)
- _listen.call(server, port)
+ _listen.apply(server, args)
}
server.close = cb => {
@@ -42,6 +42,7 @@ function Server (torrent, opts = {}) {
if (!cb) cb = () => {}
if (closed) process.nextTick(cb)
else server.close(cb)
+ torrent = null
}
function isOriginAllowed (req) {