X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Ftracker.ts;h=9bc7586d19a23412e4652cf28228e60f0971fd08;hb=fcc7c060374c3a547257d96af847352c14d6144b;hp=42f5aea8101b8de40229a8b6acd2ea7c679771de;hpb=9b67da3d9bc951c624f17dce7821036f8518d893;p=github%2FChocobozzz%2FPeerTube.git 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' import * as proxyAddr from 'proxy-addr' import { Server as WebSocketServer } from 'ws' import { CONFIG, TRACKER_RATE_LIMITS } from '../initializers/constants' +import { VideoFileModel } from '../models/video/video-file' const TrackerServer = bitTorrentTracker.Server @@ -37,7 +38,12 @@ const trackerServer = new TrackerServer({ return cb(new Error(`Too many requests (${peersIpInfoHash[ key ]} of ip ${ip} for torrent ${infoHash}`)) } - return cb() + VideoFileModel.isInfohashExists(infoHash) + .then(exists => { + if (exists === false) return cb(new Error(`Unknown infoHash ${infoHash}`)) + + return cb() + }) } })