From: Matt Joiner Date: Wed, 21 Jan 2015 13:42:03 +0000 (+1100) Subject: Code comments X-Git-Tag: v1.0.0~1365 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=2c48152b101f8ca2ceafdd8500f63720ef97e69d;p=btrtrc.git Code comments --- diff --git a/connection.go b/connection.go index 148f3624..4c2a1d25 100644 --- a/connection.go +++ b/connection.go @@ -334,10 +334,11 @@ func (c *connection) SetInterested(interested bool) { func (conn *connection) writer() { // Reduce write syscalls. buf := bufio.NewWriterSize(conn.Socket, 0x8000) // 32 KiB - // Returns immediately if the buffer contains data. + // Receives when buf is not empty. notEmpty := make(chan struct{}, 1) for { if buf.Buffered() != 0 { + // Make sure it's receivable. select { case notEmpty <- struct{}{}: default: