Class: Async::IO::SSLSocket

Inherits:
Generic
  • Object
show all
Defined in:
lib/async/io/ssl_socket.rb

Overview

Asynchronous TCP socket wrapper.

Constant Summary

Constants inherited from Generic

Generic::WRAPPERS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Generic

#read, wrap, wrap_blocking_method, wraps, #write

Class Method Details

.connect_socket(socket, context) ⇒ Object



44
45
46
47
48
49
50
51
# File 'lib/async/io/ssl_socket.rb', line 44

def self.connect_socket(socket, context)
	io = wrapped_klass.new(socket.io, context)
	
	# This ensures that when the internal IO is closed, it also closes the internal socket:
	io.sync_close = true
	
	return self.new(io, socket.reactor)
end

Instance Method Details

#acceptObject

Invokes ‘accept_nonblock` on the underlying io. If the operation would block, the current task is paused until the operation can succeed, at which point it’s resumed and the operation is completed.



33
# File 'lib/async/io/ssl_socket.rb', line 33

wrap_blocking_method :accept, :accept_nonblock

#connectObject

Invokes ‘connect_nonblock` on the underlying io. If the operation would block, the current task is paused until the operation can succeed, at which point it’s resumed and the operation is completed.



34
# File 'lib/async/io/ssl_socket.rb', line 34

wrap_blocking_method :connect, :connect_nonblock

#local_addressObject



36
37
38
# File 'lib/async/io/ssl_socket.rb', line 36

def local_address
	@io.to_io.local_address
end

#remote_addressObject



40
41
42
# File 'lib/async/io/ssl_socket.rb', line 40

def remote_address
	@io.to_io.remote_address
end