import pp peer_protocol in misc.go
This commit is contained in:
parent
d48b755776
commit
533c034747
10
misc.go
10
misc.go
|
@ -6,7 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/anacrolix/torrent/peer_protocol"
|
pp "github.com/anacrolix/torrent/peer_protocol"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -31,22 +31,22 @@ func (ih *InfoHash) HexString() string {
|
||||||
return fmt.Sprintf("%x", ih[:])
|
return fmt.Sprintf("%x", ih[:])
|
||||||
}
|
}
|
||||||
|
|
||||||
func lastChunkSpec(pieceLength peer_protocol.Integer) (cs chunkSpec) {
|
func lastChunkSpec(pieceLength pp.Integer) (cs chunkSpec) {
|
||||||
cs.Begin = (pieceLength - 1) / chunkSize * chunkSize
|
cs.Begin = (pieceLength - 1) / chunkSize * chunkSize
|
||||||
cs.Length = pieceLength - cs.Begin
|
cs.Length = pieceLength - cs.Begin
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
type chunkSpec struct {
|
type chunkSpec struct {
|
||||||
Begin, Length peer_protocol.Integer
|
Begin, Length pp.Integer
|
||||||
}
|
}
|
||||||
|
|
||||||
type request struct {
|
type request struct {
|
||||||
Index peer_protocol.Integer
|
Index pp.Integer
|
||||||
chunkSpec
|
chunkSpec
|
||||||
}
|
}
|
||||||
|
|
||||||
func newRequest(index, begin, length peer_protocol.Integer) request {
|
func newRequest(index, begin, length pp.Integer) request {
|
||||||
return request{index, chunkSpec{begin, length}}
|
return request{index, chunkSpec{begin, length}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue