]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Comments and readability
authorMatt Joiner <anacrolix@gmail.com>
Sat, 7 Jul 2018 01:33:48 +0000 (11:33 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Sat, 7 Jul 2018 01:33:48 +0000 (11:33 +1000)
config.go
connection.go
peer_protocol/decoder.go

index 899a2f062f5deb55df1ccc95c76f9bec894bf9db..0c6141c6f39157d4e31ebc220f6fc404f7ae04f7 100644 (file)
--- a/config.go
+++ b/config.go
@@ -41,8 +41,7 @@ type ClientConfig struct {
        // Disable uploading even when it isn't fair.
        DisableAggressiveUpload bool `long:"disable-aggressive-upload"`
        // Upload even after there's nothing in it for us. By default uploading is
-       // not altruistic, we'll upload slightly more than we download from each
-       // peer.
+       // not altruistic, we'll only upload to encourage the peer to reciprocate.
        Seed bool `long:"seed"`
        // Only applies to chunks uploaded to peers, to maintain responsiveness
        // communicating local Client state to peers. Each limiter token
index ba739d92ca52ddebc94ef1135048a1941ef6b915..7bad4f27624a814727be41beff6818cb22840b60 100644 (file)
@@ -398,7 +398,11 @@ func (cn *connection) nominalMaxRequests() (ret int) {
                        ),
                ))
        }
-       return int(clamp(1, int64(cn.PeerMaxRequests), max(64, cn.stats.ChunksReadUseful.Int64()-(cn.stats.ChunksRead.Int64()-cn.stats.ChunksReadUseful.Int64()))))
+       return int(clamp(
+               1,
+               int64(cn.PeerMaxRequests),
+               max(64,
+                       cn.stats.ChunksReadUseful.Int64()-(cn.stats.ChunksRead.Int64()-cn.stats.ChunksReadUseful.Int64()))))
 }
 
 func (cn *connection) totalExpectingTime() (ret time.Duration) {
index 37758fd8de495b44d3175156de6c42af535b95bc..e4aeab08f395872ee2a6a0e31931018c66353e1e 100644 (file)
@@ -35,7 +35,7 @@ func (d *Decoder) Decode(msg *Message) (err error) {
                return
        }
        msg.Keepalive = false
-       r := &io.LimitedReader{d.R, int64(length)}
+       r := &io.LimitedReader{R:d.R, N:int64(length)}
        // Check that all of r was utilized.
        defer func() {
                if err != nil {