You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
begin
# Initiate the socket connection in the background. If it doesn't fail
# immediately it will raise an IO::WaitWritable (Errno::EINPROGRESS)
# indicating the connection is in progress.
# Unlike waiting for a tcp socket to connect, you can't time out ssl socket
# connections during the connect phase properly, because IO.select only partially works.
# Instead, you have to retry.
ssl_sock.connect_nonblock
rescue Errno::EAGAIN, Errno::EWOULDBLOCK, IO::WaitReadable
if ssl_sock.wait_readable(timeout)
retry
else
raise TimeoutError
end
rescue IO::WaitWritable
if ssl_sock.wait_writable(timeout)
retry
else
raise TimeoutError
end
end
I don't have time to investigate WHY this was a problem previously, but I don't know if the retry is needed or not.
I may be missing the point, but it's usually necessary to call #connect_nonblock more than twice since a TLS handshake typically takes 2 RTT. The timeout value should be handled better, though, similarly to how net/* stdlib does.
redis/redis-rb#960 (comment)
The text was updated successfully, but these errors were encountered: