mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-16 05:13:41 +00:00
删除冗余代码
This commit is contained in:
1 parent
d4e1fd23a1
commit
fedf4a60e8
1 file changed
+1
-7
@@ -43,7 +43,6 @@ func (p *Process) Start() error {
|
|||||||
}
|
}
|
||||||
defer p.close()
|
defer p.close()
|
||||||
p.status = common.DownloadStatusStart
|
p.status = common.DownloadStatusStart
|
||||||
var fetchErr error
|
|
||||||
if p.res.Range {
|
if p.res.Range {
|
||||||
// 每个连接平均需要下载的分块大小
|
// 每个连接平均需要下载的分块大小
|
||||||
chunkSize := p.res.Size / int64(p.opts.Connections)
|
chunkSize := p.res.Size / int64(p.opts.Connections)
|
||||||
@@ -63,18 +62,13 @@ func (p *Process) Start() error {
|
|||||||
chunk := model.NewChunk(begin, end)
|
chunk := model.NewChunk(begin, end)
|
||||||
p.chunks[i] = chunk
|
p.chunks[i] = chunk
|
||||||
}
|
}
|
||||||
fetchErr = p.fetch()
|
|
||||||
} else {
|
} else {
|
||||||
// 只支持单连接下载
|
// 只支持单连接下载
|
||||||
p.chunks = make([]*model.Chunk, 1)
|
p.chunks = make([]*model.Chunk, 1)
|
||||||
p.clients = make([]*http.Response, 1)
|
p.clients = make([]*http.Response, 1)
|
||||||
p.chunks[0] = model.NewChunk(0, 0)
|
p.chunks[0] = model.NewChunk(0, 0)
|
||||||
fetchErr = p.fetch()
|
|
||||||
}
|
}
|
||||||
if fetchErr != nil && fetchErr != common.PauseErr {
|
return p.fetch()
|
||||||
p.Pause()
|
|
||||||
}
|
|
||||||
return fetchErr
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Process) Pause() error {
|
func (p *Process) Pause() error {
|
||||||
|
|||||||
Reference in new issue
Block a user