Skip to content

Commit 2a427a1

Browse files
committed
Ensure Ruby < 1.9.3 continues to work
1 parent 9cc9b4f commit 2a427a1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/redis/connection/ruby.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module SocketMixin
2727
CRLF = "\r\n".freeze
2828

2929
# Exceptions raised during non-blocking I/O ops that require retrying the op
30-
if RUBY_VERSION >= "1.9.0"
30+
if RUBY_VERSION >= "1.9.3"
3131
NBIO_READ_EXCEPTIONS = [IO::WaitReadable]
3232
NBIO_WRITE_EXCEPTIONS = [IO::WaitWritable]
3333
else
@@ -105,14 +105,14 @@ def _write_to_socket(data)
105105
begin
106106
write_nonblock(data)
107107

108-
rescue *NBIO_READ_EXCEPTIONS
109-
if IO.select([self], nil, nil, @write_timeout)
108+
rescue *NBIO_WRITE_EXCEPTIONS
109+
if IO.select(nil, [self], nil, @write_timeout)
110110
retry
111111
else
112112
raise Redis::TimeoutError
113113
end
114-
rescue *NBIO_WRITE_EXCEPTIONS
115-
if IO.select(nil, [self], nil, @write_timeout)
114+
rescue *NBIO_READ_EXCEPTIONS
115+
if IO.select([self], nil, nil, @write_timeout)
116116
retry
117117
else
118118
raise Redis::TimeoutError
@@ -306,7 +306,7 @@ def self.connect(config)
306306
if config[:scheme] == "unix"
307307
raise ArgumentError, "SSL incompatible with unix sockets" if config[:ssl]
308308
sock = UNIXSocket.connect(config[:path], config[:connect_timeout])
309-
elsif config[:ssl] && RUBY_VERSION < "1.9.0"
309+
elsif config[:ssl] && RUBY_VERSION < "1.9.3"
310310
raise ArgumentError, "This library does not support SSL on Ruby < 1.9"
311311
elsif config[:scheme] == "rediss" || config[:ssl]
312312
sock = SSLSocket.connect(config[:host], config[:port], config[:connect_timeout], config[:ssl_params])

0 commit comments

Comments
 (0)