mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-18 14:23:42 +00:00
Refactor
This commit is contained in:
1 parent
075852b847
commit
adb7d89018
19 files changed
+415
-258
No files matched your search
@@ -0,0 +1,23 @@
|
||||
package message
|
||||
|
||||
import "io"
|
||||
|
||||
// piece: <len=0009+X><id=7><index><begin><block>
|
||||
type Piece struct {
|
||||
Message
|
||||
Index uint32
|
||||
Begin uint32
|
||||
Block io.Reader
|
||||
}
|
||||
|
||||
func newPiece(index uint32, begin uint32, reader io.Reader, length uint32) *Piece {
|
||||
return &Piece{
|
||||
Message: Message{
|
||||
Length: 9 + length,
|
||||
ID: IdPiece,
|
||||
},
|
||||
Index: index,
|
||||
Begin: begin,
|
||||
Block: io.LimitReader(reader, int64(length)),
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user