From 2c48152b101f8ca2ceafdd8500f63720ef97e69d Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Thu, 22 Jan 2015 00:42:03 +1100 Subject: [PATCH] Code comments --- connection.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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: -- 2.48.1