class Dizby::BasicConnection
Attributes
shutdown_pipe[R]
Public Class Methods
new(server, stream)
click to toggle source
Calls superclass method
# File lib/dizby/stream/connection.rb, line 12 def initialize(server, stream) super(server, stream) # get the uri that the client recognizes the server as @remote_uri = read @shutdown_pipe = SelfPipe.new(*IO.pipe) @object_space = [] end
Public Instance Methods
close()
click to toggle source
Calls superclass method
# File lib/dizby/stream/connection.rb, line 43 def close @object_space.clear shutdown_pipe.close_write if shutdown_pipe super end
recv_request()
click to toggle source
# File lib/dizby/stream/connection.rb, line 22 def recv_request wait_for_stream ref, msg, argc = Array.new(3) { read } @server.log.debug("called through proxy: #{ref} #{msg}") raise ConnectionError, 'too many arguments' if @server.argc_limit < argc argv = Array.new(argc) { read } block = read ro = @server.to_obj(ref) [ro, msg, argv, block] end
send_reply(succ, result)
click to toggle source
# File lib/dizby/stream/connection.rb, line 37 def send_reply(succ, result) write(dump_data(succ) + dump_data(result, !succ)) rescue raise ConnectionError, $!.message, $!.backtrace end
Private Instance Methods
make_distributed(_obj, _error)
click to toggle source
when a distributed object is made through a connection, store it so that it doesn't get consumed by the garbage collector
Calls superclass method
# File lib/dizby/stream/connection.rb, line 53 def make_distributed(_obj, _error) distributed = super @object_space << distributed distributed end
wait_for_stream()
click to toggle source
# File lib/dizby/stream/connection.rb, line 59 def wait_for_stream readable, = IO.select([@stream, shutdown_pipe.read]) raise RemoteServerShutdown if readable.include?(shutdown_pipe.read) rescue IOError raise RemoteServerShutdown end