diff --git a/dfget/core/downloader/p2p_downloader/p2p_downloader.go b/dfget/core/downloader/p2p_downloader/p2p_downloader.go index d78be4bd6..ae7cc5432 100644 --- a/dfget/core/downloader/p2p_downloader/p2p_downloader.go +++ b/dfget/core/downloader/p2p_downloader/p2p_downloader.go @@ -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 { diff --git a/dfget/core/downloader/p2p_downloader/power_client.go b/dfget/core/downloader/p2p_downloader/power_client.go index 993b71dec..3b75b434c 100644 --- a/dfget/core/downloader/p2p_downloader/power_client.go +++ b/dfget/core/downloader/p2p_downloader/power_client.go @@ -78,7 +78,7 @@ type PowerClient struct { clientError *types.ClientErrorRequest - cdnDource apiTypes.CdnSource + cdnSource apiTypes.CdnSource fileLength int64 } @@ -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) } @@ -195,7 +195,7 @@ 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 @@ -203,7 +203,7 @@ func (pc *PowerClient) successPiece(content *bytes.Buffer) *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() {