fix(announce): update peer ip & port when changed than old peer record

This commit is contained in:
OldHawk
2018-05-14 19:00:38 +08:00
parent f2882279ab
commit 7138c4983e

View File

@@ -949,7 +949,7 @@ exports.announce = function (req, res) {
req.currentPeer.isNewCreated = false;
//if find peer_id, but some time some client (like qbittorrent 4.1.0) the ip or port is changed, update it
if (req.currentPeer.peer_ip !== req.cf_ip || req.currentPeer.peer_port !== query.port) {
if ((req.currentPeer.peer_ip !== req.cf_ip || req.currentPeer.peer_port !== query.port) && query.port !== 0) {
req.currentPeer.peer_ip = req.cf_ip;
req.currentPeer.peer_port = query.port;