Class: Celluloid::IO::SSLSocket
- Extended by:
- Forwardable
- Defined in:
- lib/celluloid/io/ssl_socket.rb
Overview
SSLSocket with Celluloid::IO support
Instance Attribute Summary
Attributes inherited from Stream
Instance Method Summary collapse
- #accept ⇒ Object
- #connect ⇒ Object
-
#initialize(io, ctx = OpenSSL::SSL::SSLContext.new) ⇒ SSLSocket
constructor
A new instance of SSLSocket.
- #to_io ⇒ Object
Methods inherited from Stream
#<<, #close, #each, #each_byte, #eof?, #flush, #getc, #gets, #print, #printf, #puts, #read, #readchar, #readline, #readlines, #readpartial, #sysread, #syswrite, #ungetc, #wait_readable, #wait_writable, #write
Constructor Details
#initialize(io, ctx = OpenSSL::SSL::SSLContext.new) ⇒ SSLSocket
Returns a new instance of SSLSocket.
24 25 26 27 28 29 |
# File 'lib/celluloid/io/ssl_socket.rb', line 24 def initialize(io, ctx = OpenSSL::SSL::SSLContext.new) super() @context = ctx @socket = OpenSSL::SSL::SSLSocket.new(::IO.try_convert(io), @context) @socket.sync_close = true if @socket.respond_to?(:sync_close=) end |
Instance Method Details
#accept ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/celluloid/io/ssl_socket.rb', line 39 def accept @socket.accept_nonblock self rescue ::IO::WaitReadable wait_readable retry rescue ::IO::WaitWritable wait_writable retry end |
#connect ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/celluloid/io/ssl_socket.rb', line 31 def connect @socket.connect_nonblock self rescue ::IO::WaitReadable wait_readable retry end |
#to_io ⇒ Object
50 |
# File 'lib/celluloid/io/ssl_socket.rb', line 50 def to_io; @socket; end |