Skip to content

Commit ae233bf

Browse files
committed
Catch SystemCallError from socket#eof? as well
1 parent 876dc19 commit ae233bf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/mongo/socket.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,10 @@ class Socket
5858
def alive?
5959
sock_arr = [ @socket ]
6060
if Kernel::select(sock_arr, nil, sock_arr, 0)
61-
!@socket.eof?
61+
eof?
6262
else
6363
true
6464
end
65-
rescue IOError
66-
false
6765
end
6866

6967
# Close the socket.
@@ -161,9 +159,11 @@ def write(*args)
161159

162160
# Tests if this socket has reached EOF. Primarily used for liveness checks.
163161
#
164-
# @since 2.0.0
162+
# @since 2.0.5
165163
def eof?
166164
@socket.eof?
165+
rescue IOError, SystemCallError => e
166+
true
167167
end
168168

169169
private

0 commit comments

Comments
 (0)