Code comments

This commit is contained in:
Matt Joiner 2015-01-22 00:42:03 +11:00
parent 67b7c5adc8
commit 2c48152b10
1 changed files with 2 additions and 1 deletions

View File

@ -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: