diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-01-31 18:27:24 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-01-31 18:27:24 -0800 |
commit | 37e50a9a5fcd45242373379c0dc61ebf8ff609af (patch) | |
tree | b42fa929f96482cb2aca430765e8ec1aa38a6515 /test | |
parent | d4773fc63a847119004c17a1b8803a815f99d98a (diff) | |
download | kgio-37e50a9a5fcd45242373379c0dc61ebf8ff609af.tar.gz |
Might as well allow clients to efficiently handle TCP_CORK/TCP_NOPUSH, too.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_autopush.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/test_autopush.rb b/test/test_autopush.rb index 4d15b7b..bbd4b46 100644 --- a/test/test_autopush.rb +++ b/test/test_autopush.rb @@ -23,6 +23,20 @@ class TestAutopush < Test::Unit::TestCase @port = @srv.addr[1] end + def test_autopush_accessors + Kgio.autopush = true + opt = RUBY_PLATFORM =~ /freebsd/ ? TCP_NOPUSH : TCP_CORK + s = Kgio::TCPSocket.new(@host, @port) + assert_equal 0, s.getsockopt(Socket::IPPROTO_TCP, opt).unpack('i')[0] + assert ! s.kgio_autopush? + s.kgio_autopush = true + assert s.kgio_autopush? + assert_nothing_raised { s.kgio_write 'asdf' } + assert_equal :wait_readable, s.kgio_tryread(1) + assert s.kgio_autopush? + assert_equal 1, s.getsockopt(Socket::IPPROTO_TCP, opt).unpack('i')[0] + end + def test_autopush_true_unix Kgio.autopush = true tmp = Tempfile.new('kgio_unix') |