* ext/socket/option.c: Use "int" for IP_MULTICAST_LOOP and
IP_MULTICAST_TTL on Mac OS X. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5af92f6369
commit
779a630aee
@ -1,3 +1,8 @@
|
|||||||
|
Tue Jan 21 04:27:30 2014 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* ext/socket/option.c: Use "int" for IP_MULTICAST_LOOP and
|
||||||
|
IP_MULTICAST_TTL on Mac OS X.
|
||||||
|
|
||||||
Tue Jan 21 00:39:15 2014 Tanaka Akira <akr@fsij.org>
|
Tue Jan 21 00:39:15 2014 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* ext/socket/option.c: Use "byte" as default argument for
|
* ext/socket/option.c: Use "byte" as default argument for
|
||||||
|
@ -7,7 +7,7 @@ VALUE rb_cSockOpt;
|
|||||||
#define CAT(x,y) x##y
|
#define CAT(x,y) x##y
|
||||||
#define XCAT(x,y) CAT(x,y)
|
#define XCAT(x,y) CAT(x,y)
|
||||||
|
|
||||||
#if defined(__linux__) || defined(__FreeBSD__)
|
#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
|
||||||
# define TYPE_IP_MULTICAST_LOOP int
|
# define TYPE_IP_MULTICAST_LOOP int
|
||||||
# define TYPE_IP_MULTICAST_TTL int
|
# define TYPE_IP_MULTICAST_TTL int
|
||||||
#else
|
#else
|
||||||
|
@ -34,6 +34,13 @@ class TestSocketOption < Test::Unit::TestCase
|
|||||||
assert_equal(128, sockopt.ipv4_multicast_loop)
|
assert_equal(128, sockopt.ipv4_multicast_loop)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_ipv4_multicast_loop_size
|
||||||
|
expected_size = Socket.open(:INET, :DGRAM) {|s|
|
||||||
|
s.getsockopt(:IP, :MULTICAST_LOOP).to_s.bytesize
|
||||||
|
}
|
||||||
|
assert_equal(expected_size, Socket::Option.ipv4_multicast_loop(0).to_s.bytesize)
|
||||||
|
end
|
||||||
|
|
||||||
def test_ipv4_multicast_ttl
|
def test_ipv4_multicast_ttl
|
||||||
sockopt = Socket::Option.ipv4_multicast_ttl(128)
|
sockopt = Socket::Option.ipv4_multicast_ttl(128)
|
||||||
assert_equal('#<Socket::Option: INET IP MULTICAST_TTL 128>', sockopt.inspect)
|
assert_equal('#<Socket::Option: INET IP MULTICAST_TTL 128>', sockopt.inspect)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user