class Celluloid::IO::UNIXServer

UNIXServer with combined blocking and evented support

Public Class Methods

new(socket) click to toggle source

@overload initialize(socket_path)

@param socket_path [String]

@overload initialize(socket)

@param socket [::UNIXServer]
Calls superclass method Celluloid::IO::Socket.new
# File lib/celluloid/io/unix_server.rb, line 19
def initialize(socket)
  if socket.kind_of? ::BasicSocket
    # socket
    fail ArgumentError, "wrong kind of socket (#{socket.class} for UNIXServer)" unless socket.kind_of? ::UNIXServer
    super(socket)
  else
    begin
      super(::UNIXServer.new(socket))
    rescue => ex
      # Translate the EADDRINUSE jRuby exception.
      raise unless RUBY_PLATFORM == 'java'
      if ex.class.name == "IOError" && # Won't agree to .is_a?(IOError)
         ex.message.include?("in use")
        raise Errno::EADDRINUSE.new(ex.message)
      end
      raise
    end
  end
end
open(socket_path) click to toggle source
# File lib/celluloid/io/unix_server.rb, line 10
def self.open(socket_path)
  self.new(socket_path)
end

Public Instance Methods

accept() click to toggle source
# File lib/celluloid/io/unix_server.rb, line 39
def accept
  Celluloid::IO.wait_readable(to_io)
  accept_nonblock
end
accept_nonblock() click to toggle source
# File lib/celluloid/io/unix_server.rb, line 44
def accept_nonblock
  Celluloid::IO::UNIXSocket.new(to_io.accept_nonblock)
end