From f70d0d2f07aa97b2aea91f2663bf40563793a793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Rodr=C3=ADguez=20Baquero?= Date: Thu, 17 Mar 2016 16:49:27 -0300 Subject: [PATCH 1/2] Fix #113 --- server.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server.js b/server.js index c4791ec..f50ea5b 100644 --- a/server.js +++ b/server.js @@ -337,6 +337,15 @@ Server.prototype._onWebSocketRequest = function (socket, opts, params) { } if (self.destroyed) return + var hashes + if (typeof params.info_hash === 'string') hashes = [ params.info_hash ] + else hashes = params.info_hash + hashes.forEach(function (info_hash) { + if (socket.infoHashes.indexOf(info_hash) === -1) { + socket.infoHashes.push(info_hash) + } + }) + response.action = params.action === common.ACTIONS.ANNOUNCE ? 'announce' : 'scrape' var peers From 5138d5c5a913b6a5bb8f633bc3ee705b5e52f86c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Rodr=C3=ADguez=20Baquero?= Date: Thu, 17 Mar 2016 16:52:48 -0300 Subject: [PATCH 2/2] Standard fix --- server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.js b/server.js index f50ea5b..57518a3 100644 --- a/server.js +++ b/server.js @@ -338,7 +338,7 @@ Server.prototype._onWebSocketRequest = function (socket, opts, params) { if (self.destroyed) return var hashes - if (typeof params.info_hash === 'string') hashes = [ params.info_hash ] + if (typeof params.info_hash === 'string') hashes = [ params.info_hash ] else hashes = params.info_hash hashes.forEach(function (info_hash) { if (socket.infoHashes.indexOf(info_hash) === -1) {