Class: DRb::DRbSSHClient

Inherits:
Object
  • Object
show all
Defined in:
lib/drbssh.rb

Overview

Base class for the DRbSSH clients.

Direct Known Subclasses

DRbSSHLocalClient, DRbSSHRemoteClient

Instance Attribute Summary collapse

Instance Method Summary collapse

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_fdObject (readonly)

Returns the value of attribute read_fd.



59
60
61
# File 'lib/drbssh.rb', line 59

def read_fd
  @read_fd
end

#receiveqObject (readonly)

Returns the value of attribute receiveq.



57
58
59
# File 'lib/drbssh.rb', line 57

def receiveq
  @receiveq
end

#sendqObject (readonly)

Returns the value of attribute sendq.



58
59
60
# File 'lib/drbssh.rb', line 58

def sendq
  @sendq
end

#write_fdObject (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

Returns:

  • (Boolean)


83
84
85
# File 'lib/drbssh.rb', line 83

def alive?
	!self.read_fd.closed? && !self.write_fd.closed?
end

#recv_replyObject



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