Class: NetworkFacade::Unix::Server

Inherits:
Base::Server show all
Defined in:
lib/network-facade/unix.rb

Instance Attribute Summary

Attributes inherited from Base::Server

#thread

Instance Method Summary collapse

Methods inherited from Base::Server

#add, #client_id, #start

Constructor Details

#initialize(options = {}) ⇒ Server

Returns a new instance of Server.



20
21
22
23
24
25
26
# File 'lib/network-facade/unix.rb', line 20

def initialize(options = {})
	options[:path] ||= PATH
	options[:close_exec] ||= true
	File.unlink(options[:path]) if File.exists?(options[:path])
	options[:server] ||= UNIXServer.open(options[:path])
	super(options)
end

Instance Method Details

#acceptObject



28
29
30
31
32
# File 'lib/network-facade/unix.rb', line 28

def accept
	client = @options[:server].accept
	client.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) if @options[:close_exec]
	client
end