Sha256: bf4aeb783cb427eebd75e8ffa01992eb7e6fe213a3bd29644d4e1f43cbef83e2
Contents?: true
Size: 782 Bytes
Versions: 6
Compression:
Stored size: 782 Bytes
Contents
require "socket" module Bunny begin require "openssl" class SSLSocket < OpenSSL::SSL::SSLSocket def read_fully(count, timeout = nil) return nil if @eof value = '' begin loop do value << read_nonblock(count - value.bytesize) break if value.bytesize >= count end rescue EOFError @eof = true rescue Errno::EAGAIN, Errno::EWOULDBLOCK, OpenSSL::SSL::SSLError => e puts e.inspect if IO.select([self], nil, nil, timeout) retry else raise Timeout::Error, "IO timeout when reading #{count} bytes" end end value end end rescue LoadError => le puts "Could not load OpenSSL" end end
Version data entries
6 entries across 6 versions & 1 rubygems