Class: OpenSSL::SSL::SSLServer

Inherits:
Object
  • Object
show all
Defined in:
lib/puma/accept_nonblock.rb

Instance Method Summary collapse

Instance Method Details

#accept_nonblockObject


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/puma/accept_nonblock.rb', line 9

def accept_nonblock
  sock = @svr.accept_nonblock

  begin
    ssl = OpenSSL::SSL::SSLSocket.new(sock, @ctx)
    ssl.sync_close = true
    ssl.accept if @start_immediately
    ssl
  rescue SSLError => ex
    if ssl
      ssl.close
    else
      sock.close
    end
    raise ex
  end
end