From a5fcce2820bd008b690ce39be86d82cb959f62f8 Mon Sep 17 00:00:00 2001 From: akr Date: Fri, 28 Jun 2013 03:16:07 +0000 Subject: * ext/socket/ipsocket.c (init_inetsock_internal): Don't use local addresses which address family is different to remote address. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/socket/test_tcp.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'test/socket') diff --git a/test/socket/test_tcp.rb b/test/socket/test_tcp.rb index 3cf1e3c36d..b594682904 100644 --- a/test/socket/test_tcp.rb +++ b/test/socket/test_tcp.rb @@ -7,19 +7,21 @@ end class TestSocket_TCPSocket < Test::Unit::TestCase def test_initialize_failure - s = TCPServer.new("localhost", nil) + addr = '127.0.0.1' + + s = TCPServer.new(addr, nil) server_port = s.addr[1] - c = TCPSocket.new("localhost", server_port) + c = TCPSocket.new(addr, server_port) client_port = c.addr[1] begin # TCPServer.new uses SO_REUSEADDR so we must create a failure on the # local address. - TCPSocket.new("localhost", server_port, "localhost", client_port) + TCPSocket.new(addr, server_port, addr, client_port) flunk "expected SystemCallError" rescue SystemCallError => e - assert_match "for \"localhost\" port #{client_port}", e.message + assert_match "for \"#{addr}\" port #{client_port}", e.message end end -- cgit v1.2.3