Class: Async::IO::SecureEndpoint

Inherits:
Endpoint
  • Object
show all
Defined in:
lib/async/io/endpoint.rb

Instance Attribute Summary

Attributes inherited from Endpoint

#options, #specification

Instance Method Summary collapse

Methods inherited from Endpoint

#accept, each, #initialize, parse, #socket_domain, #socket_protocol, #socket_type, ssl, tcp, #to_sockaddr, udp, unix

Constructor Details

This class inherits a constructor from Async::IO::Endpoint

Instance Method Details

#bind(&block) ⇒ Object



167
168
169
170
171
# File 'lib/async/io/endpoint.rb', line 167

def bind(&block)
	specification.bind do |server|
		yield SSLServer.new(server, context)
	end
end

#connect(&block) ⇒ Object



173
174
175
176
177
178
179
180
181
# File 'lib/async/io/endpoint.rb', line 173

def connect(&block)
	specification.connect do |socket|
		ssl_socket = SSLSocket.connect_socket(socket, context)
		
		ssl_socket.connect
		
		yield ssl_socket
	end
end

#contextObject



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/async/io/endpoint.rb', line 150

def context
	if context = options[:ssl_context]
		if params = self.params
			context = context.dup
			context.set_params(params)
		end
	else
		context = ::OpenSSL::SSL::SSLContext.new
		
		if params = self.params
			context.set_params(params)
		end
	end
	
	return context
end

#paramsObject



146
147
148
# File 'lib/async/io/endpoint.rb', line 146

def params
	options[:ssl_params]
end