Class: Redis::Connection::UNIXSocket

Inherits:
Socket
  • Object
show all
Includes:
SocketMixin
Defined in:
lib/redis/connection/ruby.rb,
lib/redis/connection/ruby.rb

Constant Summary

Constants included from SocketMixin

SocketMixin::CRLF

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SocketMixin

#gets, #initialize, #read, #timeout=, #write, #write_timeout=

Class Method Details

.connect(path, timeout) ⇒ Object



124
125
126
127
128
129
130
131
# File 'lib/redis/connection/ruby.rb', line 124

def self.connect(path, timeout)
  Timeout.timeout(timeout) do
    sock = new(path)
    sock
  end
rescue Timeout::Error
  raise TimeoutError
end

Instance Method Details

#_read_from_socket(nbytes, _buffer = nil) ⇒ Object

JRuby raises Errno::EAGAIN on #read_nonblock even when it says it is readable (1.6.6, in both 1.8 and 1.9 mode). Use the blocking #readpartial method instead.



137
138
139
140
141
142
143
# File 'lib/redis/connection/ruby.rb', line 137

def _read_from_socket(nbytes, _buffer = nil)
  # JRuby: Throw away the buffer as we won't need it
  # but still need to support the max arity of 2
  readpartial(nbytes)
rescue EOFError
  raise Errno::ECONNRESET
end