class SSLEndpoint
Definitions
def bind(*arguments, **options, &block)
Connect to the underlying endpoint and establish a SSL connection.
Implementation
def bind(*arguments, **options, &block)
if block_given?
@endpoint.bind(*arguments, **options) do |server|
yield self.make_server(server)
end
else
@endpoint.bind(*arguments, **options).map do |server|
self.make_server(server)
end
end
end
def connect(&block)
Connect to the underlying endpoint and establish a SSL connection.
Implementation
def connect(&block)
socket = self.make_socket(@endpoint.connect)
if hostname = self.hostname
socket.hostname = hostname
end
begin
socket.connect
rescue
socket.close
raise
end
return socket unless block_given?
begin
yield socket
ensure
socket.close
end
end