}
_, ret = t.conns[c]
delete(t.conns, c)
+ torrent.Add("deleted connections", 1)
c.deleteAllRequests()
if len(t.conns) == 0 {
t.assertNoPendingRequests()
}
// Returns true if the connection is added.
-func (t *Torrent) addConnection(c *connection) error {
+func (t *Torrent) addConnection(c *connection) (err error) {
+ defer func() {
+ if err == nil {
+ torrent.Add("added connections", 1)
+ }
+ }()
if t.closed.IsSet() {
return errors.New("torrent closed")
}