]> Sergey Matveev's repositories - btrtrc.git/blobdiff - misc.go
cmd/btrtrc client
[btrtrc.git] / misc.go
diff --git a/misc.go b/misc.go
index 42c516f0ea5568c3a1f1468e0737923fee6e46dc..b657d104288b4fbc6fcda64508bc0ef5ce00270e 100644 (file)
--- a/misc.go
+++ b/misc.go
@@ -17,7 +17,7 @@ import (
 type (
        Request       = types.Request
        ChunkSpec     = types.ChunkSpec
-       piecePriority = types.PiecePriority
+       PiecePriority = types.PiecePriority
 )
 
 const (
@@ -111,8 +111,8 @@ func chunkIndexSpec(index, pieceLength, chunkSize pp.Integer) ChunkSpec {
        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 {
@@ -124,29 +124,6 @@ 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:] {