Class: Celluloid::IO::UNIXServer
- Extended by:
- Forwardable
- Defined in:
- lib/celluloid/io/unix_server.rb
Overview
UNIXServer with combined blocking and evented support
Constant Summary
Constants inherited from Socket
Class Method Summary collapse
Instance Method Summary collapse
- #accept ⇒ Object
- #accept_nonblock ⇒ Object
-
#initialize(socket) ⇒ UNIXServer
constructor
A new instance of UNIXServer.
Methods inherited from Socket
Constructor Details
#initialize(socket_path) ⇒ UNIXServer #initialize(socket) ⇒ UNIXServer
Returns a new instance of UNIXServer.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# 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..include?("in use") raise Errno::EADDRINUSE.new(ex.) end raise end end end |
Class Method Details
.open(socket_path) ⇒ Object
10 11 12 |
# File 'lib/celluloid/io/unix_server.rb', line 10 def self.open(socket_path) self.new(socket_path) end |
Instance Method Details
#accept ⇒ Object
39 40 41 42 |
# File 'lib/celluloid/io/unix_server.rb', line 39 def accept Celluloid::IO.wait_readable(to_io) accept_nonblock end |
#accept_nonblock ⇒ Object
44 45 46 |
# File 'lib/celluloid/io/unix_server.rb', line 44 def accept_nonblock Celluloid::IO::UNIXSocket.new(to_io.accept_nonblock) end |