diff --git a/lib/webrick/server.rb b/lib/webrick/server.rb index 2d678273e5..57ffe5a48b 100644 --- a/lib/webrick/server.rb +++ b/lib/webrick/server.rb @@ -295,12 +295,14 @@ def start_thread(sock, &block) end if sock.respond_to?(:sync_close=) && @config[:SSLStartImmediately] WEBrick::Utils.timeout(@config[:RequestTimeout]) do - - # we must call OpenSSL::SSL::SSLSocket#accept_nonblock until - # it stop returning wait_* symbols: + + # we must call OpenSSL::SSL::SSLSocket#accept_nonblock until it + # stops returning wait_* symbols + # accept_nonblock can only be called once on Windows case ret = sock.accept_nonblock(exception: false) when :wait_readable, :wait_writable sock.to_io.__send__(ret) + break if /mingw|mswin/ =~ RUBY_PLATFORM else break end while true