Class: Bones::RPC::Synchronous::Connection

Inherits:
Connection
  • Object
show all
Defined in:
lib/bones/rpc/synchronous/connection.rb,
lib/bones/rpc/synchronous/connection/reader.rb,
lib/bones/rpc/synchronous/connection/writer.rb,
lib/bones/rpc/synchronous/connection/socket/ssl.rb,
lib/bones/rpc/synchronous/connection/socket/tcp.rb

Overview

This class contains behaviour of Bones::RPC socket connections.

Since:

  • 0.0.1

Defined Under Namespace

Modules: Socket Classes: Reader, Writer

Constant Summary

Constants inherited from Connection

Connection::TIMEOUT

Instance Attribute Summary

Attributes inherited from Connection

#node, #socket

Instance Method Summary collapse

Methods inherited from Connection

#alive?, #cleanup_socket, #connect, #connected?, #disconnect, #host, #initialize, #inspect, #options, #port, #timeout, writer_class

Constructor Details

This class inherits a constructor from Bones::RPC::Connection

Instance Method Details

#write(operations) ⇒ Object

Since:

  • 0.0.1



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/bones/rpc/synchronous/connection.rb', line 20

def write(operations)
  with_connection do |socket|
    proxy = writer.write(operations)
    if proxy
      Timeout::timeout(timeout) do
        while not proxy.registry_empty?
          writer.reader.read(proxy)
        end
      end
    end
  end
end