Comments and readability
This commit is contained in:
parent
e1d6fc2341
commit
e0f0617b0b
|
@ -41,8 +41,7 @@ type ClientConfig struct {
|
||||||
// Disable uploading even when it isn't fair.
|
// Disable uploading even when it isn't fair.
|
||||||
DisableAggressiveUpload bool `long:"disable-aggressive-upload"`
|
DisableAggressiveUpload bool `long:"disable-aggressive-upload"`
|
||||||
// Upload even after there's nothing in it for us. By default uploading is
|
// 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
|
// not altruistic, we'll only upload to encourage the peer to reciprocate.
|
||||||
// peer.
|
|
||||||
Seed bool `long:"seed"`
|
Seed bool `long:"seed"`
|
||||||
// Only applies to chunks uploaded to peers, to maintain responsiveness
|
// Only applies to chunks uploaded to peers, to maintain responsiveness
|
||||||
// communicating local Client state to peers. Each limiter token
|
// communicating local Client state to peers. Each limiter token
|
||||||
|
|
|
@ -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) {
|
func (cn *connection) totalExpectingTime() (ret time.Duration) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ func (d *Decoder) Decode(msg *Message) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
msg.Keepalive = false
|
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.
|
// Check that all of r was utilized.
|
||||||
defer func() {
|
defer func() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue