class Celluloid::IO::SSLServer

SSLServer wraps a TCPServer to provide immediate SSL accept

Attributes

start_immediately[RW]
tcp_server[R]

Public Class Methods

new(server, ctx) click to toggle source
# File lib/celluloid/io/ssl_server.rb, line 13
def initialize(server, ctx)
  @tcp_server = Socket.try_convert(server)
  @ctx = ctx
  @start_immediately = true
end

Public Instance Methods

accept() click to toggle source
# File lib/celluloid/io/ssl_server.rb, line 19
def accept
  sock = @tcp_server.accept
  begin
    ssl = Celluloid::IO::SSLSocket.new(sock, @ctx)
    ssl.accept if @start_immediately
    ssl
  rescue OpenSSL::SSL::SSLError
    sock.close
    raise
  end
end