diff options
Diffstat (limited to 'server.js')
-rw-r--r-- | server.js | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -150,6 +150,18 @@ | |||
150 | if (err) throw err | 150 | if (err) throw err |
151 | // Create/activate the webtorrent module | 151 | // Create/activate the webtorrent module |
152 | webtorrent.create(function () { | 152 | webtorrent.create(function () { |
153 | function cleanForExit () { | ||
154 | utils.cleanForExit(webtorrent.app) | ||
155 | } | ||
156 | |||
157 | function exitGracefullyOnSignal () { | ||
158 | process.exit() | ||
159 | } | ||
160 | |||
161 | process.on('exit', cleanForExit) | ||
162 | process.on('SIGINT', exitGracefullyOnSignal) | ||
163 | process.on('SIGTERM', exitGracefullyOnSignal) | ||
164 | |||
153 | // ----------- Make the server listening ----------- | 165 | // ----------- Make the server listening ----------- |
154 | server.listen(port, function () { | 166 | server.listen(port, function () { |
155 | videos.seedAll(function () { | 167 | videos.seedAll(function () { |