class Riak::Client::BeefcakeProtobuffsBackend::BeefcakeSocket

A factory class for making sockets, whether secure or not @api private

Public Class Methods

new(host, port, options = {}) click to toggle source
# File lib/riak/client/beefcake/socket.rb, line 15
def new(host, port, options = {})
  return start_tcp_socket(host, port) if options[:authentication].blank?
  return start_tls_socket(host, port, options[:authentication])
end

Private Class Methods

start_tcp_socket(host, port) click to toggle source
# File lib/riak/client/beefcake/socket.rb, line 21
def start_tcp_socket(host, port)
  TCPSocket.new(host, port).tap do |sock|
    sock.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, true)
  end
end
start_tls_socket(host, port, authentication) click to toggle source
# File lib/riak/client/beefcake/socket.rb, line 27
def start_tls_socket(host, port, authentication)
  raise Riak::UserConfigurationError.new if authentication[:username]

  tcp = start_tcp_socket(host, port)
  TlsInitiator.new(tcp, host, authentication).tls_socket
end