diff options
author | Eric Wong <e@80x24.org> | 2014-02-08 03:08:27 -0500 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2014-02-08 08:35:02 +0000 |
commit | dda19354de0bc72c1ab7ea49537a0ae2b019e837 (patch) | |
tree | f404df6e7d9f17f23afb18e83d1178e3d04b0300 | |
parent | d084e6caa23b585a62065b9c89503deb69be72e3 (diff) | |
download | yahns-dda19354de0bc72c1ab7ea49537a0ae2b019e837.tar.gz |
We may unnecessarily drop persistent connections from this bug, and we had an incorrect assertion in our unit test, even.
-rw-r--r-- | lib/yahns/wbuf_common.rb | 3 | ||||
-rw-r--r-- | test/test_wbuf.rb | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/yahns/wbuf_common.rb b/lib/yahns/wbuf_common.rb index b3a4502..a3e737b 100644 --- a/lib/yahns/wbuf_common.rb +++ b/lib/yahns/wbuf_common.rb @@ -25,7 +25,8 @@ module Yahns::WbufCommon # :nodoc: raise "BUG: rv=#{rv.inspect} " \ "on tmpio=#{@tmpio.inspect} " \ "sf_offset=#@sf_offset sf_count=#@sf_count" - end while true + end while @sf_count > 0 + wbuf_close(client) end def wbuf_close_common(client) diff --git a/test/test_wbuf.rb b/test/test_wbuf.rb index 25cdeba..644c76b 100644 --- a/test/test_wbuf.rb +++ b/test/test_wbuf.rb @@ -81,8 +81,8 @@ class TestWbuf < Testcase assert_equal b, IO.select([b], nil, nil, 5)[0][0] b.read(nr - 2) if nr > 2 assert_equal b, IO.select([b], nil, nil, 5)[0][0] - assert_equal "HI", b.read(2) - assert_equal false, wbuf.wbuf_flush(a) + assert_equal "HI", b.read(2), "read the end of the response" + assert_equal true, wbuf.wbuf_flush(a) ensure a.close b.close |