Socket connect blocking on windows

Hello all,

RubyTorrent is having some trouble on Windows, because making new TCP
socket connections seem to block ALL running threads. For example, the
following code hangs under Windows (but not under Linux) until the
connection timeout is reached (20s):

  require 'socket'

  t = Thread.new do
    while true
      puts "in thread"
      sleep 1
    end
  end

  sleep 2

  puts "connecting..."
  h = TCPSocket.new('192.168.0.80', 80) # bogus ip
  puts "connected!"

  t.join

This issue was mentioned before [ruby-talk:105369], and patches have
been submitted [ruby-core:3154], [ruby-core:3182], but the problem seems
to persist, at least in Ruby 1.8.2 on Windows XP.

Was this ever addressed? Is there a workaround? RubyTorrent makes a lot
of TCP connections, and a 20-second global freeze for each failed
attempt is quite a performance hit on Windows.

···

--
William <wmorgan-ruby-talk@masanjin.net>