class EventMachine::EvmaUNIXClient

@private

def self.connect chain

def self.connect chain
  sd = Socket.new( Socket::AF_LOCAL, Socket::SOCK_STREAM, 0 )
  begin
    # TODO, this assumes a current Ruby snapshot.
    # We need to degrade to a nonblocking connect otherwise.
    sd.connect_nonblock( Socket.pack_sockaddr_un( chain ))
  rescue Errno::EINPROGRESS
  end
  EvmaUNIXClient.new sd
end

def eventable_write

def eventable_write
  if @pending
    @pending = false
    if 0 == io.getsockopt(Socket::SOL_SOCKET, Socket::SO_ERROR).unpack("i").first
      EventMachine::event_callback uuid, ConnectionCompleted, ""
    end
  else
    super
  end
end

def initialize io

def initialize io
  super
  @pending = true
end

def select_for_reading?

def select_for_reading?
  @pending ? false : super
end

def select_for_writing?

def select_for_writing?
  @pending ? true : super
end