mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-19 06:43:42 +00:00
feat: http downloader
This commit is contained in:
1 parent
15e5d2af3b
commit
788376eaa9
22 files changed
+813
-64
No files matched your search
@@ -324,7 +324,7 @@ func (pc *peerConn) handlePiece(buf []byte) {
|
||||
fileWritable := f.End - blockFileBegin
|
||||
// 计算block剩余写入字节数
|
||||
blockWritable := blockLength - blockSeek
|
||||
fb := fileBlock{
|
||||
fb := &fileBlock{
|
||||
filepath: filepath.Join(f.Path...),
|
||||
fileSeek: blockFileBegin - f.Begin,
|
||||
blockBegin: blockSeek,
|
||||
@@ -420,6 +420,7 @@ func (pc *peerConn) handlePiece(buf []byte) {
|
||||
}
|
||||
|
||||
// 获取piece对应要写入的文件
|
||||
// TODO 使用sort.Search二分查找法检索
|
||||
func getWriteFile(pieceBegin int64, fds []*metainfo.FileDetail) int {
|
||||
for i, f := range fds {
|
||||
if f.Begin <= pieceBegin && f.End > pieceBegin {
|
||||
|
||||
Reference in new issue
Block a user