mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-09 10:00:27 +00:00
单个peer的文件下载实现
This commit is contained in:
1 parent
fe0138440f
commit
15a4b6ddc4
9 files changed
+179
-48
No files matched your search
@@ -26,9 +26,9 @@ func NewRequest(index uint32, begin uint32, length uint32) *Request {
|
||||
|
||||
func (r *Request) Encode() []byte {
|
||||
buf := make([]byte, 12)
|
||||
binary.BigEndian.PutUint32(buf[:4], r.Index)
|
||||
binary.BigEndian.PutUint32(buf[0:4], r.Index)
|
||||
binary.BigEndian.PutUint32(buf[4:8], r.Begin)
|
||||
binary.BigEndian.PutUint32(buf[8:], r.Length)
|
||||
binary.BigEndian.PutUint32(buf[8:12], r.Length)
|
||||
return append(r.Message.Encode(), buf...)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user