Skip to content

Commit 9a6e854

Browse files
committed
Limit number of WebRTC offers to only 5
1 parent 1de0983 commit 9a6e854

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var extend = require('xtend/mutable')
66

77
exports.DEFAULT_ANNOUNCE_INTERVAL = 30 * 60 * 1000 // 30 minutes
88

9-
exports.DEFAULT_ANNOUNCE_PEERS = process.browser ? 5 : 50
9+
exports.DEFAULT_ANNOUNCE_PEERS = 50
1010
exports.MAX_ANNOUNCE_PEERS = 82
1111

1212
exports.binaryToHex = function (str) {

lib/websocket-tracker.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ WebSocketTracker.prototype.announce = function (opts) {
5959
opts.info_hash = self.client._infoHash.toString('binary')
6060
opts.peer_id = self.client._peerId.toString('binary')
6161

62+
// Limit number of offers to only 5 (temporarily)
63+
// TODO: remove this when we cleanup old RTCPeerConnections cleanly
64+
if (opts.numWant > 5) opts.numWant = 5
65+
6266
self._generateOffers(opts.numWant, function (offers) {
6367
opts.offers = offers
6468

0 commit comments

Comments
 (0)