PeerChoked: true,
write: make(chan []byte),
post: make(chan pp.Message),
- PeerMaxRequests: 64,
+ PeerMaxRequests: 250, // Default in libtorrent is 250.
}
defer func() {
// There's a lock and deferred unlock later in this function. The
}
}
-func TestUnmarshalCompactPeer(t *testing.T) {
- var p Peer
- err := bencode.Unmarshal([]byte("6:\x01\x02\x03\x04\x05\x06"), &p)
- if err != nil {
- t.Fatal(err)
- }
- if p.IP.String() != "1.2.3.4" {
- t.FailNow()
- }
-}
-
func TestUnmarshalPEXMsg(t *testing.T) {
var m peerExchangeMessage
if err := bencode.Unmarshal([]byte("d5:added12:\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0ce"), &m); err != nil {
}
func (t *torrent) Length() int64 {
- return int64(t.PieceLength(pp.Integer(len(t.Pieces)-1))) + int64(len(t.Pieces)-1)*int64(t.PieceLength(0))
+ return int64(t.LastPieceSize()) + int64(len(t.Pieces)-1)*int64(t.UsualPieceSize())
}
func (t *torrent) Close() (err error) {