1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

backported from CVS_HEAD

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
seki 2004-12-16 14:31:55 +00:00
parent 574697efc3
commit 06df6d6696
4 changed files with 39 additions and 8 deletions

View file

@ -1,3 +1,11 @@
Thu Dec 16 23:25:25 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
* lib/drb/drb.rb, lib/drb/ssl.rb: backported from CVS HEAD.
[druby-ja:101]
* test/drb/test_drb.rb: adjust and reduce sleep (backported from
CVS HEAD.)
Thu Dec 16 18:44:58 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
* lib/webrick/httpserver.rb (WEBrick::HTTPServer#run): should wait

View file

@ -815,14 +815,40 @@ module DRb
self.new(uri, soc, config)
end
def self.getservername
host = Socket::gethostname
begin
Socket::gethostbyname(host)[0]
rescue
host
end
end
def self.open_server_inaddr_any(host, port)
infos = Socket::getaddrinfo(host, nil,
Socket::AF_UNSPEC,
Socket::SOCK_STREAM,
0,
Socket::AI_PASSIVE)
family = infos.collect { |af, *_| af }.uniq
case family
when ['AF_INET']
return TCPServer.open('0.0.0.0', port)
when ['AF_INET6']
return TCPServer.open('::', port)
else
return TCPServer.open(port)
end
end
# Open a server listening for connections at +uri+ using
# configuration +config+.
def self.open_server(uri, config)
uri = 'druby://:0' unless uri
host, port, opt = parse_uri(uri)
if host.size == 0
soc = TCPServer.open(port)
host = Socket.gethostname
host = getservername
soc = open_server_inaddr_any(host, port)
else
soc = TCPServer.open(host, port)
end

View file

@ -136,8 +136,8 @@ module DRb
uri = 'drbssl://:0' unless uri
host, port, opt = parse_uri(uri)
if host.size == 0
soc = TCPServer.open(port)
host = Socket.gethostname
host = getservername
soc = open_server_inaddr_any(host, port)
else
soc = TCPServer.open(host, port)
end

View file

@ -193,7 +193,7 @@ end
class TestDRbReusePort < TestDRbAry
def setup
sleep 1
sleep 1.2
@ext = DRbService.manager.service('ut_port.rb')
@there = @ext.front
end
@ -201,7 +201,6 @@ end
class TestDRbSafe1 < TestDRbAry
def setup
sleep 1
@ext = DRbService.manager.service('ut_safe1.rb')
@there = @ext.front
end
@ -210,7 +209,6 @@ end
class TestDRbEval < Test::Unit::TestCase
def setup
super
sleep 1
@ext = DRbService.manager.service('ut_eval.rb')
@there = @ext.front
end
@ -242,7 +240,6 @@ end
class TestDRbLarge < Test::Unit::TestCase
def setup
sleep 1
@ext = DRbService.manager.service('ut_large.rb')
@there = @ext.front
end