type (
Request = types.Request
ChunkSpec = types.ChunkSpec
- piecePriority = types.PiecePriority
+ PiecePriority = types.PiecePriority
)
const (
return ret
}
-func connLessTrusted(l, r *Peer) bool {
- return l.trust().Less(r.trust())
+func comparePeerTrust(l, r *Peer) int {
+ return l.trust().Cmp(r.trust())
}
func connIsIpv6(nc interface {
return rip.To4() == nil && rip.To16() != nil
}
-func clamp(min, value, max int64) int64 {
- if min > max {
- panic("harumph")
- }
- if value < min {
- value = min
- }
- if value > max {
- value = max
- }
- return value
-}
-
-func max(as ...int64) int64 {
- ret := as[0]
- for _, a := range as[1:] {
- if a > ret {
- ret = a
- }
- }
- return ret
-}
-
func maxInt(as ...int) int {
ret := as[0]
for _, a := range as[1:] {