Created
October 5, 2011 14:02
-
-
Save toreriklinnerud/1264493 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
loop do | |
puts "in loop" | |
if o = IO.select([input, ssl_socket].compact, nil, nil, activity_timeout) | |
puts "in select if" | |
if (input && (o.first.first == input)) | |
puts "in if" | |
data = input.readpartial(10000) | |
puts "read partial" | |
ssl_socket.write(data) | |
puts "wrote" | |
ssl_socket.flush | |
puts "flushed" | |
elsif (o.first.first == ssl_socket) | |
puts "in else" | |
data = ssl_socket.readpartial(10000) | |
puts "read partial" | |
output.write(data) | |
puts "wrote" | |
end | |
else | |
raise(Timeout::Error.new) | |
end | |
end | |
rescue EOFError, Errno::EIO =>e | |
puts "Rescuing from error: #{e.inspect}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment