Class: Cod::BidirServer
- Inherits:
-
SocketServer
- Object
- SocketServer
- Cod::BidirServer
- Includes:
- Callbacks
- Defined in:
- lib/cod/bidir_server.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Attributes inherited from SocketServer
Instance Method Summary collapse
- #back_channel(socket) ⇒ Object
- #deserialize_special(socket, obj) ⇒ Object
-
#initialize(path, serializer) ⇒ BidirServer
constructor
A new instance of BidirServer.
Methods included from Callbacks
#callbacks_enabled?, #register_callback, #using_callbacks
Methods inherited from SocketServer
#close, #connections, #get, #get_ext, #request_close, #to_read_fds
Constructor Details
#initialize(path, serializer) ⇒ BidirServer
Returns a new instance of BidirServer.
7 8 9 10 11 12 |
# File 'lib/cod/bidir_server.rb', line 7 def initialize(path, serializer) super serializer || SimpleSerializer.new, UNIXServer.new(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/cod/bidir_server.rb', line 5 def path @path end |
Instance Method Details
#back_channel(socket) ⇒ Object
30 31 32 |
# File 'lib/cod/bidir_server.rb', line 30 def back_channel(socket) Bidir.new(serializer, nil, socket, nil) end |
#deserialize_special(socket, obj) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/cod/bidir_server.rb', line 14 def deserialize_special(socket, obj) case obj when Bidir::OtherEnd if obj.path == self.path return back_channel(socket) end channel = Bidir.new(serializer, nil, nil, nil) register_callback { |conn| channel.socket= conn.recv_io(UNIXSocket) } return channel end obj end |