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

Get rid of sporadic WSAEACCES on Windows [ruby-dev:42661]

This commit is contained in:
Nobuyoshi Nakada 2021-05-20 20:15:43 +09:00
parent 817764bd82
commit e9974a466a
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
2 changed files with 10 additions and 2 deletions

View file

@ -363,7 +363,12 @@ class TestSocketAddrinfo < Test::Unit::TestCase
def random_port
# IANA suggests dynamic port for 49152 to 65535
# http://www.iana.org/assignments/port-numbers
49152 + rand(65535-49152+1)
case RUBY_PLATFORM
when /mingw|mswin/
rand(50000..65535)
else
rand(49152..65535)
end
end
def errors_addrinuse

View file

@ -172,7 +172,10 @@ class TestSocket < Test::Unit::TestCase
end
def errors_addrinuse
[Errno::EADDRINUSE]
errs = [Errno::EADDRINUSE]
# MinGW fails with "Errno::EACCES: Permission denied - bind(2) for 0.0.0.0:49721"
errs << Errno::EACCES if /mingw/ =~ RUBY_PLATFORM
errs
end
def test_tcp_server_sockets