From 30b6f176b16f771302c471413309b7289290425c Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Thu, 2 Feb 2017 16:59:36 -0800 Subject: [PATCH] ws client: Don't include offers with 'completed' event It's not necessary to include webrtc offers because the client is not really looking for more peers when it has just completed the torrent. Fewer WebRTC offers = less resource usage --- lib/client/websocket-tracker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/client/websocket-tracker.js b/lib/client/websocket-tracker.js index 0e7844b..894408e 100644 --- a/lib/client/websocket-tracker.js +++ b/lib/client/websocket-tracker.js @@ -60,8 +60,8 @@ WebSocketTracker.prototype.announce = function (opts) { }) if (self._trackerId) params.trackerid = self._trackerId - if (opts.event === 'stopped') { - // Don't include offers with 'stopped' event + if (opts.event === 'stopped' || opts.event === 'completed') { + // Don't include offers with 'stopped' or 'completed' event self._send(params) } else { // Limit the number of offers that are generated, since it can be slow