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

ability to close and restore streaming server #1547

Merged
merged 2 commits into from Jun 11, 2019
Merged
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

Prev

ability to close and restore streamin server

  • Loading branch information
untitledlt committed Nov 22, 2018
commit 5dc293f857ddd333afbc5ec52053e7ad07bf58a0
@@ -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) {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.