in platform/consensus/ordering/pbft/performance_manager.cpp [127:167]
int PerformanceManager::ProcessResponseMsg(std::unique_ptr<Context> context,
std::unique_ptr<Request> request) {
std::unique_ptr<Request> response;
std::string hash = request->hash();
int32_t primary_id = request->primary_id();
uint64_t seq = request->seq();
// Add the response message, and use the call back to collect the received
// messages.
// The callback will be triggered if it received f+1 messages.
if (request->ret() == -2) {
// LOG(INFO) << "get response fail:" << request->ret();
// send_num_--;
RemoveWaitingResponseRequest(hash);
return 0;
}
CollectorResultCode ret =
AddResponseMsg(context->signature, std::move(request),
[&](const Request& request,
const TransactionCollector::CollectorDataType*) {
response = std::make_unique<Request>(request);
return;
});
if (ret == CollectorResultCode::STATE_CHANGED) {
BatchUserResponse batch_response;
if (batch_response.ParseFromString(response->data())) {
if (seq > highest_seq_) {
highest_seq_ = seq;
if (highest_seq_primary_id_ != primary_id) {
system_info_->SetPrimary(primary_id);
highest_seq_primary_id_ = primary_id;
}
}
SendResponseToClient(batch_response);
RemoveWaitingResponseRequest(hash);
} else {
LOG(ERROR) << "parse response fail:";
}
}
return ret == CollectorResultCode::INVALID ? -2 : 0;
}