class Mongo::UNIXSocket

Wrapper class for Socket

Emulates UNIXSocket with operation and connection timeout sans Timeout::timeout

Public Class Methods

new(socket_path, port=:socket, op_timeout=nil, connect_timeout=nil, opts={}) click to toggle source
# File lib/mongo/connection/socket/unix_socket.rb, line 25
def initialize(socket_path, port=:socket, op_timeout=nil, connect_timeout=nil, opts={})
  @op_timeout      = op_timeout
  @connect_timeout = connect_timeout
  @pid             = Process.pid
  @auths           = Set.new

  @address         = socket_path
  @port            = :socket # purposely override input

  @socket_address  = Socket.pack_sockaddr_un(@address)
  @socket          = Socket.new(Socket::AF_UNIX, Socket::SOCK_STREAM, 0)
  connect(@socket, @socket_address)
end