]> Sergey Matveev's repositories - btrtrc.git/commit
connection.writer wasn't working efficiently
authorMatt Joiner <anacrolix@gmail.com>
Sun, 2 Aug 2015 10:39:31 +0000 (20:39 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Sun, 2 Aug 2015 10:39:31 +0000 (20:39 +1000)
commit1cc50f85a6dbd1ca6a5f6e59c30b2f952cf8a923
tree60420647e141c6e706651e9697370caf58962595
parentc735370f9b27c532ba42c032434b3181fe5cc312
connection.writer wasn't working efficiently

Because of the pseudo-random selection of a communication in a select statement, flushing was occuring prematurely. Also the buffer was needlessly large. For large messages, like outgoing pieces, it's probably better they just go straight to the wire anyway.

This change will make it easier to implement sending of pieces that doesn't block control messages in the future. Any time that the buffer is empty, we'll be able to signal that it's an optimal time to send a piece.
connection.go