Skip to content

Commit 20b7a66

Browse files
committed
Merge pull request webtorrent#134 from DiegoRBaquero/patch-1
Fix webtorrent#133
2 parents 4642467 + 5138d5c commit 20b7a66

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

server.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,15 @@ Server.prototype._onWebSocketRequest = function (socket, opts, params) {
337337
}
338338
if (self.destroyed) return
339339

340+
var hashes
341+
if (typeof params.info_hash === 'string') hashes = [ params.info_hash ]
342+
else hashes = params.info_hash
343+
hashes.forEach(function (info_hash) {
344+
if (socket.infoHashes.indexOf(info_hash) === -1) {
345+
socket.infoHashes.push(info_hash)
346+
}
347+
})
348+
340349
response.action = params.action === common.ACTIONS.ANNOUNCE ? 'announce' : 'scrape'
341350

342351
var peers

0 commit comments

Comments
 (0)