Created
May 18, 2009 10:02
-
-
Save jodosha/113404 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if Config::CONFIG['host'] =~ /mswin/i | |
def socket_active? | |
return false if not @sock or @sock.closed? | |
begin | |
@sock.write("\0") | |
Timeout.timeout(0.1){ @sock.read } # TODO make 0.1 configurable | |
rescue Exception | |
false | |
end | |
end | |
else | |
def socket_active? | |
@sock and not @sock.closed? and @sock.stat.readable? | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment