]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Code comments
authorMatt Joiner <anacrolix@gmail.com>
Wed, 21 Jan 2015 13:42:03 +0000 (00:42 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Wed, 21 Jan 2015 13:42:03 +0000 (00:42 +1100)
connection.go

index 148f362430ccb079f9bd4787eae7f9e10f21bc5c..4c2a1d2556cf2c0976971fd99970545dbfc1ebbb 100644 (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: