lib/mongo/operation/shared/executable.rb in mongo-2.11.6 vs lib/mongo/operation/shared/executable.rb in mongo-2.12.0.rc0

- old
+ new

@@ -20,41 +20,43 @@ # @since 2.5.2 module Executable include ResponseHandling - def do_execute(server) + def do_execute(server, client) unpin_maybe(session) do add_error_labels do add_server_diagnostics(server) do - get_result(server).tap do |result| + get_result(server, client).tap do |result| process_result(result, server) end end end end end - def execute(server) - do_execute(server).tap do |result| + def execute(server, client:) + do_execute(server, client).tap do |result| validate_result(result, server) end end private def result_class Result end - def get_result(server) - result_class.new(dispatch_message(server)) + def get_result(server, client) + result_class.new(dispatch_message(server, client)) end # Returns a Protocol::Message or nil - def dispatch_message(server) + def dispatch_message(server, client) server.with_connection do |connection| - connection.dispatch([ build_message(server) ], operation_id) + message = build_message(server) + message = message.maybe_encrypt(server, client) + connection.dispatch([ message ], operation_id, client) end end def build_message(server) message(server)