Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

typo: fix typo cdnDource to cdnSource #1316

Merged
merged 1 commit into from
Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dfget/core/downloader/p2p_downloader/p2p_downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ func (p2p *P2PDownloader) startTask(data *types.PullPieceTaskResponseContinueDat
rateLimiter: p2p.rateLimiter,
downloadAPI: api.NewDownloadAPI(),
headers: p2p.headers,
cdnDource: p2p.RegisterResult.CDNSource,
cdnSource: p2p.RegisterResult.CDNSource,
fileLength: p2p.RegisterResult.FileLength,
}
if err := powerClient.Run(); err != nil && powerClient.ClientError() != nil {
Expand Down
8 changes: 4 additions & 4 deletions dfget/core/downloader/p2p_downloader/power_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ type PowerClient struct {

clientError *types.ClientErrorRequest

cdnDource apiTypes.CdnSource
cdnSource apiTypes.CdnSource
fileLength int64
}

Expand Down Expand Up @@ -174,7 +174,7 @@ func (pc *PowerClient) downloadPiece() (content *bytes.Buffer, e error) {
func (pc *PowerClient) createDownloadRequest() *api.DownloadRequest {
pieceRange := pc.pieceTask.Range
headers := netutils.ConvertHeaders(pc.headers)
if pc.cdnDource == apiTypes.CdnSourceSource {
if pc.cdnSource == apiTypes.CdnSourceSource {
if pc.fileLength > 0 {
pieceRange = wipeOutOfRange(pc.pieceTask.Range, pc.fileLength)
}
Expand All @@ -195,15 +195,15 @@ func (pc *PowerClient) createDownloadRequest() *api.DownloadRequest {

func (pc *PowerClient) successPiece(content *bytes.Buffer) *Piece {
piece := NewPieceContent(pc.taskID, pc.node, pc.pieceTask.Cid, pc.pieceTask.Range,
constants.ResultSemiSuc, constants.TaskStatusRunning, content, pc.cdnDource)
constants.ResultSemiSuc, constants.TaskStatusRunning, content, pc.cdnSource)
piece.PieceSize = pc.pieceTask.PieceSize
piece.PieceNum = pc.pieceTask.PieceNum
return piece
}

func (pc *PowerClient) failPiece() *Piece {
return NewPiece(pc.taskID, pc.node, pc.pieceTask.Cid, pc.pieceTask.Range,
constants.ResultFail, constants.TaskStatusRunning, pc.cdnDource)
constants.ResultFail, constants.TaskStatusRunning, pc.cdnSource)
}

func (pc *PowerClient) initFileNotExistError() {
Expand Down