Class: Async::IO::SSLServer
- Inherits:
-
Object
- Object
- Async::IO::SSLServer
- Extended by:
- Forwardable
- Includes:
- ServerSocket
- Defined in:
- lib/async/io/ssl_socket.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
Instance Method Summary collapse
- #accept(task: Task.current) ⇒ Object
-
#initialize(server, context) ⇒ SSLServer
constructor
A new instance of SSLServer.
- #listen(*args) ⇒ Object
Methods included from ServerSocket
Constructor Details
#initialize(server, context) ⇒ SSLServer
Returns a new instance of SSLServer.
58 59 60 61 |
# File 'lib/async/io/ssl_socket.rb', line 58 def initialize(server, context) @server = server @context = context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
66 67 68 |
# File 'lib/async/io/ssl_socket.rb', line 66 def context @context end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
65 66 67 |
# File 'lib/async/io/ssl_socket.rb', line 65 def server @server end |
Instance Method Details
#accept(task: Task.current) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/async/io/ssl_socket.rb', line 74 def accept(task: Task.current) peer, address = @server.accept wrapper = SSLSocket.connect_socket(peer, @context) if block_given? task.async do task.annotate "accepting secure connection #{address}" begin wrapper.accept yield wrapper, address rescue SSLError Async.logger.error($!.class) {$!} ensure wrapper.close end end else return wrapper, address end end |
#listen(*args) ⇒ Object
70 71 72 |
# File 'lib/async/io/ssl_socket.rb', line 70 def listen(*args) @server.listen(*args) end |