jodosha (owner)

Revisions

gist: 113404 Download_button fork
public
Public Clone URL: git://gist.github.com/113404.git
Embed All Files: show embed
server.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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