Sha256: 6ccfb9404103e498fba50afd8631d48ce3c51b1f583e3fdc3a61fc39f70191e7
Contents?: true
Size: 804 Bytes
Versions: 3
Compression:
Stored size: 804 Bytes
Contents
require 'socket' module Celluloid module IO # TCPServer with combined blocking and evented support class TCPServer extend Forwardable def_delegators :@server, :listen, :sysaccept, :close, :closed?, :addr def initialize(hostname, port) @server = ::TCPServer.new(hostname, port) end def accept Celluloid::IO.wait_readable(@server) accept_nonblock end def accept_nonblock Celluloid::IO::TCPSocket.new(@server.accept_nonblock) end def to_io @server end # Convert a Ruby TCPServer into a Celluloid::IO::TCPServer def self.from_ruby_server(ruby_server) server = allocate server.instance_variable_set(:@server, ruby_server) server end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
celluloid-io-0.14.1 | lib/celluloid/io/tcp_server.rb |
celluloid-io-0.14.0 | lib/celluloid/io/tcp_server.rb |
celluloid-io-0.14.0.pre | lib/celluloid/io/tcp_server.rb |