connection.writer wasn't working efficiently
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.

dborzov/torrent,bluepeppers/torrent,oldfaust/torrent,therewillbecode/torrent,anacrolix/torrent,anacrolix/torrent