aboutsummaryrefslogtreecommitdiffhomepage
path: root/server.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-02-09 13:15:40 +0100
committerChocobozzz <me@florianbigard.com>2018-02-09 13:15:40 +0100
commit1e9d7b60cd93ad5d1aed47fd157f1993d4b4eac0 (patch)
tree4b15a32c622877c93ca334f43be678856f99c14e /server.ts
parent53ac1448f073a5db69f934550404c6997822501e (diff)
downloadPeerTube-1e9d7b60cd93ad5d1aed47fd157f1993d4b4eac0.tar.gz
PeerTube-1e9d7b60cd93ad5d1aed47fd157f1993d4b4eac0.tar.zst
PeerTube-1e9d7b60cd93ad5d1aed47fd157f1993d4b4eac0.zip
Fix crash with websocket tracker
Diffstat (limited to 'server.ts')
-rw-r--r--server.ts5
1 files changed, 2 insertions, 3 deletions
diff --git a/server.ts b/server.ts
index 8f280f6c2..dc7a71d60 100644
--- a/server.ts
+++ b/server.ts
@@ -104,11 +104,11 @@ const trackerServer = new TrackerServer({
104}) 104})
105 105
106trackerServer.on('error', function (err) { 106trackerServer.on('error', function (err) {
107 logger.error(err) 107 logger.error('Error in websocket tracker.', err)
108}) 108})
109 109
110trackerServer.on('warning', function (err) { 110trackerServer.on('warning', function (err) {
111 logger.error(err) 111 logger.error('Warning in websocket tracker.', err)
112}) 112})
113 113
114const server = http.createServer(app) 114const server = http.createServer(app)
@@ -116,7 +116,6 @@ const wss = new WebSocketServer({ server: server, path: '/tracker/socket' })
116wss.on('connection', function (ws) { 116wss.on('connection', function (ws) {
117 trackerServer.onWebSocketConnection(ws) 117 trackerServer.onWebSocketConnection(ws)
118}) 118})
119wss.on('error', err => logger.error('Error in websocket server.', err))
120 119
121const onHttpRequest = trackerServer.onHttpRequest.bind(trackerServer) 120const onHttpRequest = trackerServer.onHttpRequest.bind(trackerServer)
122app.get('/tracker/announce', (req, res) => onHttpRequest(req, res, { action: 'announce' })) 121app.get('/tracker/announce', (req, res) => onHttpRequest(req, res, { action: 'announce' }))