]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Increase peer connection buffer size from default (4096) to 20KiB
authorMatt Joiner <anacrolix@gmail.com>
Sat, 13 Sep 2014 17:47:06 +0000 (03:47 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Sat, 13 Sep 2014 17:47:06 +0000 (03:47 +1000)
This reduces syscall overhead which becoming noticeable.

client.go

index 72782463ee948d57367e60f519f62dbd9743d1cb..d9ca34221e6e6b952ae694cfcfff8a46616a73dc 100644 (file)
--- a/client.go
+++ b/client.go
@@ -745,7 +745,7 @@ type peerExchangeMessage struct {
 // and exit.
 func (me *Client) connectionLoop(t *torrent, c *connection) error {
        decoder := pp.Decoder{
-               R:         bufio.NewReader(c.Socket),
+               R:         bufio.NewReaderSize(c.Socket, 20*1024),
                MaxLength: 256 * 1024,
        }
        for {