Permalink
Browse files

If sending data on a socket fails, close the socket.

This mirrors the behavior on receive, and can prevent a situation
where we keep trying to use the same socket to send data after a
connection is dropped.
  • Loading branch information...
1 parent 85e0c3f commit 5c2b4bb4e8dbd7f628cbc0b2a9774427437a0930 @nelhage nelhage committed Nov 12, 2012
Showing with 1 addition and 0 deletions.
  1. +1 −0 lib/mongo/networking.rb
View
@@ -282,6 +282,7 @@ def send_message_on_socket(packed_message, socket)
end
total_bytes_sent
rescue => ex
+ socket.close
raise ConnectionFailure, "Operation failed with the following exception: #{ex}:#{ex.message}"
end
end

0 comments on commit 5c2b4bb

Please sign in to comment.