class OpenSSL::SSL::SSLSocket
OpenSSL
socket helper methods (to make it compatible with Socket
API) and overrides
Public Class Methods
new(socket, context = nil)
click to toggle source
# File lib/polyphony/extensions/openssl.rb, line 13 def initialize(socket, context = nil) socket = socket.respond_to?(:io) ? socket.io || socket : socket context ? orig_initialize(socket, context) : orig_initialize(socket) end
Also aliased as: orig_initialize
Public Instance Methods
__parser_read_method__()
click to toggle source
# File lib/polyphony/extensions/openssl.rb, line 8 def __parser_read_method__ :readpartial end
dont_linger()
click to toggle source
# File lib/polyphony/extensions/openssl.rb, line 18 def dont_linger io.dont_linger end
fill_rbuff()
click to toggle source
# File lib/polyphony/extensions/openssl.rb, line 30 def fill_rbuff data = self.sysread(BLOCK_SIZE) if data @rbuffer << data else @eof = true end end
flush()
click to toggle source
# File lib/polyphony/extensions/openssl.rb, line 62 def flush # osync = @sync # @sync = true # do_write "" # return self # ensure # @sync = osync end
no_delay()
click to toggle source
# File lib/polyphony/extensions/openssl.rb, line 22 def no_delay io.no_delay end
peeraddr(_ = nil)
click to toggle source
# File lib/polyphony/extensions/openssl.rb, line 110 def peeraddr(_ = nil) orig_peeraddr end
Also aliased as: orig_peeraddr
read(maxlen = nil, buf = nil, buf_pos = 0)
click to toggle source
# File lib/polyphony/extensions/openssl.rb, line 72 def read(maxlen = nil, buf = nil, buf_pos = 0) return readpartial(maxlen, buf, buf_pos) if buf buf = +'' return readpartial(maxlen, buf) if maxlen while true readpartial(4096, buf, -1) end rescue EOFError buf end
Also aliased as: orig_read
read_loop(maxlen = 8192) { |data| ... }
click to toggle source
# File lib/polyphony/extensions/openssl.rb, line 102 def read_loop(maxlen = 8192) while (data = sysread(maxlen)) yield data end end
Also aliased as: recv_loop
readpartial(maxlen, buf = +'', buffer_pos = 0, raise_on_eof = true)
click to toggle source
# File lib/polyphony/extensions/openssl.rb, line 85 def readpartial(maxlen, buf = +'', buffer_pos = 0, raise_on_eof = true) if buffer_pos != 0 if (result = sysread(maxlen, +'')) if buffer_pos == -1 result = buf + result else result = buf[0...buffer_pos] + result end end else result = sysread(maxlen, buf) end raise EOFError if !result && raise_on_eof result end
reuse_addr()
click to toggle source
# File lib/polyphony/extensions/openssl.rb, line 26 def reuse_addr io.reuse_addr end
sysread(maxlen, buf = +'')
click to toggle source
# File lib/polyphony/extensions/openssl.rb, line 40 def sysread(maxlen, buf = +'') while true case (result = read_nonblock(maxlen, buf, exception: false)) when :wait_readable then Polyphony.backend_wait_io(io, false) when :wait_writable then Polyphony.backend_wait_io(io, true) else return result end end end
Also aliased as: orig_sysread
syswrite(buf)
click to toggle source
# File lib/polyphony/extensions/openssl.rb, line 51 def syswrite(buf) while true case (result = write_nonblock(buf, exception: false)) when :wait_readable then Polyphony.backend_wait_io(io, false) when :wait_writable then Polyphony.backend_wait_io(io, true) else return result end end end
Also aliased as: orig_syswrite