-
Notifications
You must be signed in to change notification settings - Fork 774
[Fix] Supernode local cdn connet check is not necessary when --cdnPattern=s… #1518
base: master
Are you sure you want to change the base?
Conversation
We found this is your first time to contribute to Dragonfly, @PWZER |
917e42f
to
ad27d3f
Compare
…ource Signed-off-by: PWZER <pwzergo@gmail.com>
Signed-off-by: PWZER <pwzergo@gmail.com>
Strictly speaking, we don't need an Nginx file server for supernode within source pattern. Thanks for your contribution. |
@@ -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 != pc.node && pc.pieceTask.Path != pc.cfg.URL { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use pc.cdnSource != apiTypes.CdnSourceSource
is better? WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@starnop There are three scenarios.
pc.cdnSource == apiTypes.CdnSourceSource && dstIP != supernodeIp
, connect check is very necessary.- Only
pc.pieceTask.Path != pc.cfg.URL
, need download piece from other peer, anddstIP != supernodeIp
, connect check is very necessary. - Only
pc.pieceTask.Path == pc.cfg.URL
, need download piece from source,anddstIP == supernodeIp
, connect check is not necessary.
…ource
Ⅰ. Describe what this PR did
当 cdn = "source" 时,supernode 机器上的 nginx 服务是非必须的。而 dfget 请求 /peer/task 时返回的 PeerIP, PeerPort 分别是 supernodeIp,8001。这个时候是不需要对 supernodeIp:8001 进行检查的。
Ⅱ. Does this pull request fix one issue?
NONE
Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)
Yes
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews