From c8cc97afea914e4192d6c2f2df47d26ad4acc0f2 Mon Sep 17 00:00:00 2001 From: thermatk Date: Fri, 4 Apr 2014 19:59:25 +0400 Subject: [PATCH] Fix for unknown port For example, in torrents from Yify their tracker has url "udp://tracker.yify-torrents.com/announce" in which case a crtitical error is shown because "port should be in range from 0 to 65535" --- index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.js b/index.js index 64b8331..b49e0d8 100644 --- a/index.js +++ b/index.js @@ -208,6 +208,9 @@ Client.prototype._requestUdp = function (announceUrl, opts) { }) function send (message) { + if(parsedUrl.port==null) { + parsedUrl.port=80; + } socket.send(message, 0, message.length, parsedUrl.port, parsedUrl.hostname) }