ResponseStatus NetworkInterfaceASIO::AsyncCommand::response(AsyncOp* op, rpc::Protocol protocol, Date_t now, rpc::EgressMetadataHook* metadataHook) { auto& received = _toRecv; if (received.operation() == dbCompressed) { auto swm = conn().getCompressorManager().decompressMessage(received); if (!swm.isOK()) { return swm.getStatus(); } received = std::move(swm.getValue()); } switch (_type) { case CommandType::kRPC: { auto rs = decodeRPC(&received, protocol, now - _start, _target, metadataHook); if (rs.isOK()) op->setResponseMetadata(rs.metadata); return rs; } case CommandType::kDownConvertedFind: { auto ns = DbMessage(_toSend).getns(); return upconvertLegacyQueryResponse(_toSend.header().getId(), ns, received); } case CommandType::kDownConvertedGetMore: { auto ns = DbMessage(_toSend).getns(); return upconvertLegacyGetMoreResponse(_toSend.header().getId(), ns, received); } } MONGO_UNREACHABLE; }
ResponseStatus NetworkInterfaceASIO::AsyncCommand::response(rpc::Protocol protocol, Date_t now, rpc::EgressMetadataHook* metadataHook) { auto& received = _toRecv; switch (_type) { case CommandType::kRPC: { return decodeRPC(&received, protocol, now - _start, _target, metadataHook); } case CommandType::kDownConvertedFind: { auto ns = DbMessage(_toSend).getns(); return upconvertLegacyQueryResponse(_toSend.header().getId(), ns, received); } case CommandType::kDownConvertedGetMore: { auto ns = DbMessage(_toSend).getns(); return upconvertLegacyGetMoreResponse(_toSend.header().getId(), ns, received); } } MONGO_UNREACHABLE; }