X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server.js;h=96c493f29d9ba9eaae6c1751d1704519c8e0af5f;hb=0ae2e7f73c24779f8c99453fb02491382cc0520e;hp=fe0cb237addeb15951ed196ec40afcd8242e91e5;hpb=3a443402a6f22e4ac1fd80af62abfef7efd6d7a4;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server.js b/server.js index fe0cb237a..96c493f29 100644 --- a/server.js +++ b/server.js @@ -150,6 +150,18 @@ if (err) throw err // Create/activate the webtorrent module webtorrent.create(function () { + function cleanForExit () { + utils.cleanForExit(webtorrent.app) + } + + function exitGracefullyOnSignal () { + process.exit() + } + + process.on('exit', cleanForExit) + process.on('SIGINT', exitGracefullyOnSignal) + process.on('SIGTERM', exitGracefullyOnSignal) + // ----------- Make the server listening ----------- server.listen(port, function () { videos.seedAll(function () {