summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-05-20 20:15:43 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-05-20 21:56:58 +0900
commitc71109355987f290257e977c1634db6328916786 (patch)
tree8e573583f2425d8c00b8a07ca2b115cdb4f4c350
parentdfe21ef7a15a30fc33f3a5cc089e15d09e905eb4 (diff)
downloadruby-c71109355987f290257e977c1634db6328916786.tar.gz
Get rid of sporadic WSAEACCES on Windows [ruby-dev:42661]
-rw-r--r--test/socket/test_socket.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/socket/test_socket.rb b/test/socket/test_socket.rb
index 9cef9f0d6f..77ce093101 100644
--- a/test/socket/test_socket.rb
+++ b/test/socket/test_socket.rb
@@ -163,7 +163,12 @@ class TestSocket < 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