Sha256: b0d775029f1378f4c722c55ba0c474bcdf3bf3eb2f14c1f632d804f6d119a0b4
Contents?: true
Size: 1021 Bytes
Versions: 3
Compression:
Stored size: 1021 Bytes
Contents
require 'socket' module Celluloid module IO # UNIXServer with combined blocking and evented support class UNIXServer extend Forwardable def_delegators :@server, :listen, :sysaccept, :close, :closed? def self.open(socket_path) self.new(socket_path) end def initialize(socket_path) @server = ::UNIXServer.new(socket_path) end def accept actor = Thread.current[:celluloid_actor] if evented? Celluloid.current_actor.wait_readable @server accept_nonblock else Celluloid::IO::UNIXSocket.from_ruby_socket @server.accept end end def accept_nonblock Celluloid::IO::UNIXSocket.from_ruby_socket @server.accept_nonblock end def to_io @server end # Are we inside a Celluloid ::IO actor? def evented? actor = Thread.current[:celluloid_actor] actor && actor.mailbox.is_a?(Celluloid::IO::Mailbox) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
celluloid-io-0.13.0 | lib/celluloid/io/unix_server.rb |
celluloid-io-0.13.0.pre2 | lib/celluloid/io/unix_server.rb |
celluloid-io-0.13.0.pre | lib/celluloid/io/unix_server.rb |