diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-02-25 10:16:21 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-02-25 10:16:21 +0000 |
commit | e86d271d9605bda1b19d534e108054e2902613da (patch) | |
tree | 4c0cdb87f116d5f1d3043c3f37a8631f8928fbfe /test | |
parent | 784005805cd879ef3e51111f778e74741fb0ba0b (diff) |
merge revision(s) 53561: [Backport #11958]
* 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/branches/ruby_2_1@53931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-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 d1f6f29c34..f085a4f0c4 100644 --- a/test/socket/test_sockopt.rb +++ b/test/socket/test_sockopt.rb @@ -23,6 +23,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 |