aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/tracker.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/tracker.ts')
-rw-r--r--server/controllers/tracker.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/server/controllers/tracker.ts b/server/controllers/tracker.ts
index 42f5aea81..9bc7586d1 100644
--- a/server/controllers/tracker.ts
+++ b/server/controllers/tracker.ts
@@ -5,6 +5,7 @@ import * as bitTorrentTracker from 'bittorrent-tracker'
5import * as proxyAddr from 'proxy-addr' 5import * as proxyAddr from 'proxy-addr'
6import { Server as WebSocketServer } from 'ws' 6import { Server as WebSocketServer } from 'ws'
7import { CONFIG, TRACKER_RATE_LIMITS } from '../initializers/constants' 7import { CONFIG, TRACKER_RATE_LIMITS } from '../initializers/constants'
8import { VideoFileModel } from '../models/video/video-file'
8 9
9const TrackerServer = bitTorrentTracker.Server 10const TrackerServer = bitTorrentTracker.Server
10 11
@@ -37,7 +38,12 @@ const trackerServer = new TrackerServer({
37 return cb(new Error(`Too many requests (${peersIpInfoHash[ key ]} of ip ${ip} for torrent ${infoHash}`)) 38 return cb(new Error(`Too many requests (${peersIpInfoHash[ key ]} of ip ${ip} for torrent ${infoHash}`))
38 } 39 }
39 40
40 return cb() 41 VideoFileModel.isInfohashExists(infoHash)
42 .then(exists => {
43 if (exists === false) return cb(new Error(`Unknown infoHash ${infoHash}`))
44
45 return cb()
46 })
41 } 47 }
42}) 48})
43 49