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
This commit is contained in:
Feross Aboukhadijeh 2017-02-02 16:59:36 -08:00
parent fb751d7c96
commit 30b6f176b1

View File

@ -60,8 +60,8 @@ WebSocketTracker.prototype.announce = function (opts) {
}) })
if (self._trackerId) params.trackerid = self._trackerId if (self._trackerId) params.trackerid = self._trackerId
if (opts.event === 'stopped') { if (opts.event === 'stopped' || opts.event === 'completed') {
// Don't include offers with 'stopped' event // Don't include offers with 'stopped' or 'completed' event
self._send(params) self._send(params)
} else { } else {
// Limit the number of offers that are generated, since it can be slow // Limit the number of offers that are generated, since it can be slow