Class: Proxy::RemoteExecution::Cockpit::OpenSSLBufferedSocket
Class Method Summary
collapse
Instance Method Summary
collapse
build, #initialize
#available, #enqueue, #fill, #pending_writes?, #read_available, #send_pending, #wait_for_pending_sends
Class Method Details
.applies_for?(socket) ⇒ Boolean
51
52
53
|
# File 'lib/smart_proxy_remote_execution_ssh/cockpit.rb', line 51
def self.applies_for?(socket)
socket.is_a? ::OpenSSL::SSL::SSLSocket
end
|
Instance Method Details
#recv(count) ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/smart_proxy_remote_execution_ssh/cockpit.rb', line 56
def recv(count)
res = ""
begin
loop do
res += @socket.read_nonblock(count)
end
rescue IO::WaitReadable
if res == ""
IO.select([@socket.to_io])
retry
else
res
end
rescue IO::WaitWritable
IO.select(nil, [@socket.to_io])
retry
end
end
|
#send(mesg, flags) ⇒ Object
83
84
85
86
87
88
89
90
|
# File 'lib/smart_proxy_remote_execution_ssh/cockpit.rb', line 83
def send(mesg, flags)
@socket.write_nonblock(mesg)
rescue IO::WaitWritable
0
rescue IO::WaitReadable
IO.select([@socket.to_io])
retry
end
|