diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-01-17 06:31:36 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-01-17 06:31:36 +0000 |
commit | 0bc53416909fe4470b9cac34072b0b3c555218a3 (patch) | |
tree | 83ed1268fc7353ad3d787e0068a6f6be935522f7 /test/socket | |
parent | f918d2b8e2f2736f57bd2ff01167702757e0a75b (diff) |
option.c: single byte boolean
* ext/socket/option.c (sockopt_bool): relax boolean size to be one
too not only sizeof(int). Winsock getsockopt() returns a single
byte as a boolean socket option. [ruby-core:72730] [Bug #11958]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/socket')
-rw-r--r-- | test/socket/test_sockopt.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/socket/test_sockopt.rb b/test/socket/test_sockopt.rb index 0a2937e4fe..f38ac2a891 100644 --- a/test/socket/test_sockopt.rb +++ b/test/socket/test_sockopt.rb @@ -25,6 +25,12 @@ class TestSocketOption < Test::Unit::TestCase assert_equal(true, opt.bool) opt = Socket::Option.int(:INET, :SOCKET, :KEEPALIVE, 2) assert_equal(true, opt.bool) + Socket.open(:INET, :STREAM) {|s| + s.setsockopt(Socket::Option.bool(:INET, :SOCKET, :KEEPALIVE, true)) + assert_equal(true, s.getsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE).bool) + s.setsockopt(Socket::Option.bool(:INET, :SOCKET, :KEEPALIVE, false)) + assert_equal(false, s.getsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE).bool) + } end def test_ipv4_multicast_loop |