RUBY-429 wrap IO errors from select and read
This commit is contained in:
parent
dfca0dd134
commit
0bd7d3830d
@ -60,14 +60,19 @@ module Mongo
|
||||
|
||||
def read(maxlen, buffer)
|
||||
# Block on data to read for @op_timeout seconds
|
||||
if IO.select([@socket], nil, [@socket], @op_timeout)
|
||||
begin
|
||||
ready = IO.select([@socket], nil, [@socket], @op_timeout)
|
||||
rescue IOError
|
||||
raise OperationFailure
|
||||
end
|
||||
if ready
|
||||
begin
|
||||
@socket.readpartial(maxlen, buffer)
|
||||
rescue EOFError
|
||||
return ConnectionError
|
||||
rescue Errno::ENOTCONN, Errno::EBADF, Errno::ECONNRESET, Errno::EPIPE
|
||||
raise ConnectionFailure
|
||||
rescue Errno::EINTR, Errno::EIO
|
||||
rescue Errno::EINTR, Errno::EIO, IOError
|
||||
raise OperationFailure
|
||||
end
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user