Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1316 from hxbaishikele/typo_v1
Browse files Browse the repository at this point in the history
typo: fix typo cdnDource to cdnSource
  • Loading branch information
lowzj authored Apr 29, 2020
2 parents 4eda7c3 + 2c6d041 commit 93152ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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

0 comments on commit 93152ce

Please sign in to comment.