class Async::IO::SSLServer
We reimplement this from scratch because the native implementation doesn't expose the underlying server/context that we need to implement non-blocking accept.
Attributes
context[R]
server[R]
Public Class Methods
new(server, context)
click to toggle source
# File lib/async/io/ssl_socket.rb, line 109 def initialize(server, context) @server = server @context = context end
Public Instance Methods
accept(task: Task.current, **options) { |wrapper, address| ... }
click to toggle source
# File lib/async/io/ssl_socket.rb, line 131 def accept(task: Task.current, **options) peer, address = @server.accept(**options) wrapper = SSLSocket.new(peer, @context) return wrapper, address unless block_given? task.async do task.annotate "accepting secure connection #{address.inspect}" begin # You want to do this in a nested async task or you might suffer from head-of-line blocking. wrapper.accept yield wrapper, address ensure wrapper.close end end end
dup()
click to toggle source
# File lib/async/io/ssl_socket.rb, line 118 def dup self.class.new(@server.dup, @context) end
fileno()
click to toggle source
# File lib/async/io/ssl_socket.rb, line 114 def fileno @server.fileno end
listen(*args)
click to toggle source
# File lib/async/io/ssl_socket.rb, line 127 def listen(*args) @server.listen(*args) end