Skip to content

Commit

Permalink
close connection when safe mode insert results in 'not master'
Browse files Browse the repository at this point in the history
  • Loading branch information
banker committed Oct 30, 2010
1 parent 424f08a commit 2939932
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/mongo/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ def send_message_with_safe_check(operation, message, db_name, log_message=nil, l
checkin(sock)
end
if num_received == 1 && (error = docs[0]['err'] || docs[0]['errmsg'])
close
close if error == "not master"
raise Mongo::OperationFailure, error
end
[docs, num_received, cursor_id]
Expand Down Expand Up @@ -744,7 +744,7 @@ def receive_header(sock)
response_to = header.get_int
op = header.get_int
end

def receive_and_discard_header(sock)
bytes_read = receive_and_discard_message_on_socket(16, sock)
unless bytes_read == STANDARD_HEADER_SIZE
Expand Down

0 comments on commit 2939932

Please sign in to comment.