Fix download issues
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package chunk
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/binary"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
@@ -144,7 +144,12 @@ func (m *Manager) GetChunk(object *torrent.File, offset, size int64) ([]byte, er
|
||||
}
|
||||
|
||||
func buildRequestID(object *torrent.File, offset int64) (id RequestID) {
|
||||
hex.Decode(id[:], []byte(object.Link))
|
||||
fileID := object.Link
|
||||
if fileID == "" {
|
||||
fileID = object.Path
|
||||
}
|
||||
hash := sha256.Sum256([]byte(fileID))
|
||||
copy(id[:16], hash[:16])
|
||||
binary.BigEndian.PutUint64(id[16:], uint64(offset))
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user