Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Monkey patch for timeout-free net/http io on JRuby
- if defined?(JRUBY_VERSION)
- require 'net/http'
- class Net::BufferedIO #:nodoc:
- alias :old_rbuf_fill :rbuf_fill
- def rbuf_fill
- if IO.select([@io], nil, nil, @read_timeout)
- @rbuf << @io.read(65536)
- else
- raise Timeout::TimeoutError
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement