From 83b7b3ef9582b05462b851571cf9dce44276b88c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 25 Feb 2016 09:34:08 +0000 Subject: linux: tcp_listener_stats drops "true" placeholders With invalid addresses specified which give no currently-bound address, we must avoid leaving placeholders ('true' objects) in our results. Clean up some shadowing "cur" while we're at it. --- test/test_linux.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test') diff --git a/test/test_linux.rb b/test/test_linux.rb index 0e79a86..bfefcc4 100644 --- a/test/test_linux.rb +++ b/test/test_linux.rb @@ -214,6 +214,13 @@ class TestLinux < Test::Unit::TestCase assert_equal 0, stats[addr1].active assert_equal 1, stats[addr2].queued assert_equal 1, stats[addr2].active + + # make sure we don't leave "true" placeholders in results if a + # listener becomes invalid (even momentarily). + s2.close + stats = tcp_listener_stats(addrs) + assert stats.values.all? { |x| x.instance_of?(Raindrops::ListenStats) }, + "placeholders left: #{stats.inspect}" end # tries to overflow buffers -- cgit v1.2.3-24-ge0c7