diff options
Diffstat (limited to 'server/controllers/tracker.ts')
-rw-r--r-- | server/controllers/tracker.ts | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/server/controllers/tracker.ts b/server/controllers/tracker.ts index 37f8f12c9..da9c68c6c 100644 --- a/server/controllers/tracker.ts +++ b/server/controllers/tracker.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import * as bitTorrentTracker from 'bittorrent-tracker' | 1 | import { Server as TrackerServer } from 'bittorrent-tracker' |
2 | import * as express from 'express' | 2 | import express from 'express' |
3 | import * as http from 'http' | 3 | import { createServer } from 'http' |
4 | import * as proxyAddr from 'proxy-addr' | 4 | import proxyAddr from 'proxy-addr' |
5 | import { Server as WebSocketServer } from 'ws' | 5 | import { Server as WebSocketServer } from 'ws' |
6 | import { Redis } from '@server/lib/redis' | 6 | import { Redis } from '@server/lib/redis' |
7 | import { logger } from '../helpers/logger' | 7 | import { logger } from '../helpers/logger' |
@@ -10,8 +10,6 @@ import { TRACKER_RATE_LIMITS } from '../initializers/constants' | |||
10 | import { VideoFileModel } from '../models/video/video-file' | 10 | import { VideoFileModel } from '../models/video/video-file' |
11 | import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist' | 11 | import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist' |
12 | 12 | ||
13 | const TrackerServer = bitTorrentTracker.Server | ||
14 | |||
15 | const trackerRouter = express.Router() | 13 | const trackerRouter = express.Router() |
16 | 14 | ||
17 | let peersIps = {} | 15 | let peersIps = {} |
@@ -86,7 +84,7 @@ trackerRouter.get('/tracker/announce', (req, res) => onHttpRequest(req, res, { a | |||
86 | trackerRouter.get('/tracker/scrape', (req, res) => onHttpRequest(req, res, { action: 'scrape' })) | 84 | trackerRouter.get('/tracker/scrape', (req, res) => onHttpRequest(req, res, { action: 'scrape' })) |
87 | 85 | ||
88 | function createWebsocketTrackerServer (app: express.Application) { | 86 | function createWebsocketTrackerServer (app: express.Application) { |
89 | const server = http.createServer(app) | 87 | const server = createServer(app) |
90 | const wss = new WebSocketServer({ noServer: true }) | 88 | const wss = new WebSocketServer({ noServer: true }) |
91 | 89 | ||
92 | wss.on('connection', function (ws, req) { | 90 | wss.on('connection', function (ws, req) { |