connection.go | 6 ++++-- diff --git a/connection.go b/connection.go index 00c92da63d412c90c337ddc6eb8a44ab794707b6..99931aa255f9aa44743f25d84b04ad0fd72a1e70 100644 --- a/connection.go +++ b/connection.go @@ -4,15 +4,17 @@ import ( "container/list" "encoding" "errors" + "expvar" "fmt" "io" - "log" "net" "sync" "time" pp "bitbucket.org/anacrolix/go.torrent/peer_protocol" ) + +var optimizedCancels = expvar.NewInt("optimizedCancels") type peerSource byte @@ -339,7 +341,7 @@ for e := pending.Back(); e != nil; e = e.Prev() { elemMsg := e.Value.(pp.Message) if elemMsg.Type == pp.Request && msg.Index == elemMsg.Index && msg.Begin == elemMsg.Begin && msg.Length == elemMsg.Length { pending.Remove(e) - log.Printf("optimized cancel! %v", msg) + optimizedCancels.Add(1) break event } }