From: Matt Joiner Date: Thu, 17 Sep 2015 02:50:29 +0000 (+1000) Subject: Count failed chunk sends against a connection X-Git-Tag: v1.0.0~1042 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=11d703fbf138caf5b6437f3c0c7c9e2239b95ec6;p=btrtrc.git Count failed chunk sends against a connection --- diff --git a/client.go b/client.go index 16782a9c..5caaf76a 100644 --- a/client.go +++ b/client.go @@ -1448,6 +1448,8 @@ another: } func (me *Client) sendChunk(t *torrent, c *connection, r request) error { + // Count the chunk being sent, even if it isn't. + c.chunksSent++ b := make([]byte, r.Length) tp := t.Pieces[r.Index] tp.pendingWritesMutex.Lock() @@ -1470,7 +1472,6 @@ func (me *Client) sendChunk(t *torrent, c *connection, r request) error { Piece: b, }) uploadChunksPosted.Add(1) - c.chunksSent++ c.lastChunkSent = time.Now() return nil }