Skip to content

Commit fa81e21

Browse files
committed
simplify the socket wait logic
1 parent ae7f1cf commit fa81e21

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/mongo/socket.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,7 @@ def write_chunk(chunk, timeout)
543543
def wait_for_socket_to_be_writable(deadline)
544544
select_timeout = deadline - Utils.monotonic_time
545545
rv = Kernel.select(nil, [@socket], nil, select_timeout)
546+
546547
if BSON::Environment.jruby?
547548
# Ignore the return value of Kernel.select.
548549
# On JRuby, select appears to return nil prior to timeout expiration
@@ -551,11 +552,9 @@ def wait_for_socket_to_be_writable(deadline)
551552
# Check the deadline ourselves.
552553
select_timeout = deadline - Utils.monotonic_time
553554
return select_timeout > 0
554-
elsif rv.nil?
555-
return false
556555
end
557556

558-
true
557+
!rv.nil?
559558
end
560559

561560
def unix_socket?(sock)

0 commit comments

Comments
 (0)