From 9c4b2442971e03fed8004c5d2047cbd35fc9cb49 Mon Sep 17 00:00:00 2001 From: Oleg Anastasyev Date: Fri, 23 Oct 2020 14:48:26 +0300 Subject: [PATCH] bugfix: CDN == "source" does not request pieces from source when supernode was configured with explicily defined port Signed-off-by: Oleg Anastasyev --- dfget/core/downloader/p2p_downloader/power_client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dfget/core/downloader/p2p_downloader/power_client.go b/dfget/core/downloader/p2p_downloader/power_client.go index 17f5a30a3..46f66d3ea 100644 --- a/dfget/core/downloader/p2p_downloader/power_client.go +++ b/dfget/core/downloader/p2p_downloader/power_client.go @@ -52,7 +52,7 @@ type PowerClient struct { taskID string // headers is the extra HTTP headers when downloading a piece. headers []string - // node indicates the IP address of the currently registered supernode. + // node indicates the IP address[:port] of the currently registered supernode. node string // pieceTask is the data when successfully pulling piece task // and the task is continuing. @@ -119,7 +119,7 @@ func (pc *PowerClient) downloadPiece() (content *pool.Buffer, e error) { peerPort := pc.pieceTask.PeerPort // check that the target download peer is available - if dstIP != "" && dstIP != pc.node { + if dstIP != "" && dstIP != netutils.ExtractHost(pc.node) { if _, e = httputils.CheckConnect(dstIP, peerPort, -1); e != nil { return nil, e }