Class: DRb::DRbSSHClient
- Inherits:
-
Object
- Object
- DRb::DRbSSHClient
- Defined in:
- lib/drbssh.rb
Overview
Base class for the DRbSSH clients.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#read_fd ⇒ Object
readonly
Returns the value of attribute read_fd.
-
#receiveq ⇒ Object
readonly
Returns the value of attribute receiveq.
-
#sendq ⇒ Object
readonly
Returns the value of attribute sendq.
-
#write_fd ⇒ Object
readonly
Returns the value of attribute write_fd.
Instance Method Summary collapse
- #alive? ⇒ Boolean
-
#initialize(server) ⇒ DRbSSHClient
constructor
A new instance of DRbSSHClient.
- #recv_reply ⇒ Object
- #send_request(ref, msg_id, arg, b) ⇒ Object
Constructor Details
#initialize(server) ⇒ DRbSSHClient
Returns a new instance of DRbSSHClient.
62 63 64 65 66 67 |
# File 'lib/drbssh.rb', line 62 def initialize(server) @receiveq, @sendq = Queue.new, Queue.new @write_fd.sync = true server.client_queue.push(self) end |
Instance Attribute Details
#read_fd ⇒ Object (readonly)
Returns the value of attribute read_fd.
59 60 61 |
# File 'lib/drbssh.rb', line 59 def read_fd @read_fd end |
#receiveq ⇒ Object (readonly)
Returns the value of attribute receiveq.
57 58 59 |
# File 'lib/drbssh.rb', line 57 def receiveq @receiveq end |
#sendq ⇒ Object (readonly)
Returns the value of attribute sendq.
58 59 60 |
# File 'lib/drbssh.rb', line 58 def sendq @sendq end |
#write_fd ⇒ Object (readonly)
Returns the value of attribute write_fd.
60 61 62 |
# File 'lib/drbssh.rb', line 60 def write_fd @write_fd end |
Instance Method Details
#alive? ⇒ Boolean
83 84 85 |
# File 'lib/drbssh.rb', line 83 def alive? !self.read_fd.closed? && !self.write_fd.closed? end |
#recv_reply ⇒ Object
73 74 75 76 77 78 79 80 81 |
# File 'lib/drbssh.rb', line 73 def recv_reply reply = @receiveq.pop if reply.is_a? Exception self.close raise reply else reply end end |
#send_request(ref, msg_id, arg, b) ⇒ Object
69 70 71 |
# File 'lib/drbssh.rb', line 69 def send_request(ref, msg_id, arg, b) @sendq.push(['req', [ref, msg_id, arg, b]]) end |