]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Fix broken connection write optimizer test
authorMatt Joiner <anacrolix@gmail.com>
Thu, 26 Jun 2014 07:30:54 +0000 (17:30 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Thu, 26 Jun 2014 07:30:54 +0000 (17:30 +1000)
connection_test.go

index 9374a66d1defdd848e7673dec4136ba936df00f3..280afe9f2ceead4e0a4b351434d8c3e5645ff003 100644 (file)
@@ -39,8 +39,11 @@ func TestCancelRequestOptimized(t *testing.T) {
                }
        }
        close(c.post)
-       _, ok := <-c.write
-       if ok {
-               t.Fatal("write channel didn't close")
+       // Drain the write channel until it closes.
+       for b := range c.write {
+               bs := string(b)
+               if bs != "\x00\x00\x00\x00" {
+                       t.Fatal("got unexpected non-keepalive")
+               }
        }
 }