|
|
@ -20,9 +20,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
#include <vector> |
|
|
|
#include <vector> |
|
|
|
|
|
|
|
|
|
|
|
#include <grpc/support/log.h> |
|
|
|
#include "absl/log/log.h" |
|
|
|
|
|
|
|
|
|
|
|
#include "src/core/lib/gprpp/crash.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using grpc::reflection::v1alpha::ErrorResponse; |
|
|
|
using grpc::reflection::v1alpha::ErrorResponse; |
|
|
|
using grpc::reflection::v1alpha::ListServiceResponse; |
|
|
|
using grpc::reflection::v1alpha::ListServiceResponse; |
|
|
@ -86,23 +84,19 @@ bool ProtoReflectionDescriptorDatabase::FindFileByName( |
|
|
|
ServerReflectionResponse::MessageResponseCase::kErrorResponse) { |
|
|
|
ServerReflectionResponse::MessageResponseCase::kErrorResponse) { |
|
|
|
const ErrorResponse& error = response.error_response(); |
|
|
|
const ErrorResponse& error = response.error_response(); |
|
|
|
if (error.error_code() == StatusCode::NOT_FOUND) { |
|
|
|
if (error.error_code() == StatusCode::NOT_FOUND) { |
|
|
|
gpr_log(GPR_INFO, "NOT_FOUND from server for FindFileByName(%s)", |
|
|
|
LOG(INFO) << "NOT_FOUND from server for FindFileByName(" << filename |
|
|
|
filename.c_str()); |
|
|
|
<< ")"; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
gpr_log(GPR_INFO, |
|
|
|
LOG(INFO) << "Error on FindFileByName(" << filename |
|
|
|
"Error on FindFileByName(%s)\n\tError code: %d\n" |
|
|
|
<< ")\n\tError code: " << error.error_code() |
|
|
|
"\tError Message: %s", |
|
|
|
<< "\n\tError Message: " << error.error_message(); |
|
|
|
filename.c_str(), error.error_code(), |
|
|
|
|
|
|
|
error.error_message().c_str()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
gpr_log( |
|
|
|
LOG(INFO) << "Error on FindFileByName(" << filename |
|
|
|
GPR_INFO, |
|
|
|
<< ") response type\n\tExpecting: " |
|
|
|
"Error on FindFileByName(%s) response type\n" |
|
|
|
<< ServerReflectionResponse::MessageResponseCase:: |
|
|
|
"\tExpecting: %d\n\tReceived: %d", |
|
|
|
kFileDescriptorResponse |
|
|
|
filename.c_str(), |
|
|
|
<< "\n\tReceived: " << response.message_response_case(); |
|
|
|
ServerReflectionResponse::MessageResponseCase::kFileDescriptorResponse, |
|
|
|
|
|
|
|
response.message_response_case()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return cached_db_.FindFileByName(filename, output); |
|
|
|
return cached_db_.FindFileByName(filename, output); |
|
|
@ -134,24 +128,19 @@ bool ProtoReflectionDescriptorDatabase::FindFileContainingSymbol( |
|
|
|
const ErrorResponse& error = response.error_response(); |
|
|
|
const ErrorResponse& error = response.error_response(); |
|
|
|
if (error.error_code() == StatusCode::NOT_FOUND) { |
|
|
|
if (error.error_code() == StatusCode::NOT_FOUND) { |
|
|
|
missing_symbols_.insert(symbol_name); |
|
|
|
missing_symbols_.insert(symbol_name); |
|
|
|
gpr_log(GPR_INFO, |
|
|
|
LOG(INFO) << "NOT_FOUND from server for FindFileContainingSymbol(" |
|
|
|
"NOT_FOUND from server for FindFileContainingSymbol(%s)", |
|
|
|
<< symbol_name << ")"; |
|
|
|
symbol_name.c_str()); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
gpr_log(GPR_INFO, |
|
|
|
LOG(INFO) << "Error on FindFileContainingSymbol(" << symbol_name |
|
|
|
"Error on FindFileContainingSymbol(%s)\n" |
|
|
|
<< ")\n\tError code: " << error.error_code() |
|
|
|
"\tError code: %d\n\tError Message: %s", |
|
|
|
<< "\n\tError Message: " << error.error_message(); |
|
|
|
symbol_name.c_str(), error.error_code(), |
|
|
|
|
|
|
|
error.error_message().c_str()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
gpr_log( |
|
|
|
LOG(INFO) << "Error on FindFileContainingSymbol(" << symbol_name |
|
|
|
GPR_INFO, |
|
|
|
<< ") response type\n\tExpecting: " |
|
|
|
"Error on FindFileContainingSymbol(%s) response type\n" |
|
|
|
<< ServerReflectionResponse::MessageResponseCase:: |
|
|
|
"\tExpecting: %d\n\tReceived: %d", |
|
|
|
kFileDescriptorResponse |
|
|
|
symbol_name.c_str(), |
|
|
|
<< "\n\tReceived: " << response.message_response_case(); |
|
|
|
ServerReflectionResponse::MessageResponseCase::kFileDescriptorResponse, |
|
|
|
|
|
|
|
response.message_response_case()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return cached_db_.FindFileContainingSymbol(symbol_name, output); |
|
|
|
return cached_db_.FindFileContainingSymbol(symbol_name, output); |
|
|
|
} |
|
|
|
} |
|
|
@ -167,7 +156,7 @@ bool ProtoReflectionDescriptorDatabase::FindFileContainingExtension( |
|
|
|
if (missing_extensions_.find(containing_type) != missing_extensions_.end() && |
|
|
|
if (missing_extensions_.find(containing_type) != missing_extensions_.end() && |
|
|
|
missing_extensions_[containing_type].find(field_number) != |
|
|
|
missing_extensions_[containing_type].find(field_number) != |
|
|
|
missing_extensions_[containing_type].end()) { |
|
|
|
missing_extensions_[containing_type].end()) { |
|
|
|
gpr_log(GPR_INFO, "nested map."); |
|
|
|
LOG(INFO) << "nested map."; |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -194,24 +183,20 @@ bool ProtoReflectionDescriptorDatabase::FindFileContainingExtension( |
|
|
|
missing_extensions_[containing_type] = {}; |
|
|
|
missing_extensions_[containing_type] = {}; |
|
|
|
} |
|
|
|
} |
|
|
|
missing_extensions_[containing_type].insert(field_number); |
|
|
|
missing_extensions_[containing_type].insert(field_number); |
|
|
|
gpr_log(GPR_INFO, |
|
|
|
LOG(INFO) << "NOT_FOUND from server for FindFileContainingExtension(" |
|
|
|
"NOT_FOUND from server for FindFileContainingExtension(%s, %d)", |
|
|
|
<< containing_type << ", " << field_number << ")"; |
|
|
|
containing_type.c_str(), field_number); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
gpr_log(GPR_INFO, |
|
|
|
LOG(INFO) << "Error on FindFileContainingExtension(" << containing_type |
|
|
|
"Error on FindFileContainingExtension(%s, %d)\n" |
|
|
|
<< ", " << field_number |
|
|
|
"\tError code: %d\n\tError Message: %s", |
|
|
|
<< ")\n\tError code: " << error.error_code() |
|
|
|
containing_type.c_str(), field_number, error.error_code(), |
|
|
|
<< "\n\tError Message: " << error.error_message(); |
|
|
|
error.error_message().c_str()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
gpr_log( |
|
|
|
LOG(INFO) << "Error on FindFileContainingExtension(" << containing_type |
|
|
|
GPR_INFO, |
|
|
|
<< ", " << field_number << ") response type\n\tExpecting: " |
|
|
|
"Error on FindFileContainingExtension(%s, %d) response type\n" |
|
|
|
<< ServerReflectionResponse::MessageResponseCase:: |
|
|
|
"\tExpecting: %d\n\tReceived: %d", |
|
|
|
kFileDescriptorResponse |
|
|
|
containing_type.c_str(), field_number, |
|
|
|
<< "\n\tReceived: " << response.message_response_case(); |
|
|
|
ServerReflectionResponse::MessageResponseCase::kFileDescriptorResponse, |
|
|
|
|
|
|
|
response.message_response_case()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return cached_db_.FindFileContainingExtension(containing_type, field_number, |
|
|
|
return cached_db_.FindFileContainingExtension(containing_type, field_number, |
|
|
@ -245,14 +230,12 @@ bool ProtoReflectionDescriptorDatabase::FindAllExtensionNumbers( |
|
|
|
ServerReflectionResponse::MessageResponseCase::kErrorResponse) { |
|
|
|
ServerReflectionResponse::MessageResponseCase::kErrorResponse) { |
|
|
|
const ErrorResponse& error = response.error_response(); |
|
|
|
const ErrorResponse& error = response.error_response(); |
|
|
|
if (error.error_code() == StatusCode::NOT_FOUND) { |
|
|
|
if (error.error_code() == StatusCode::NOT_FOUND) { |
|
|
|
gpr_log(GPR_INFO, "NOT_FOUND from server for FindAllExtensionNumbers(%s)", |
|
|
|
LOG(INFO) << "NOT_FOUND from server for FindAllExtensionNumbers(" |
|
|
|
extendee_type.c_str()); |
|
|
|
<< extendee_type << ")"; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
gpr_log(GPR_INFO, |
|
|
|
LOG(INFO) << "Error on FindAllExtensionNumbersExtension(" << extendee_type |
|
|
|
"Error on FindAllExtensionNumbersExtension(%s)\n" |
|
|
|
<< ")\n\tError code: " << error.error_code() |
|
|
|
"\tError code: %d\n\tError Message: %s", |
|
|
|
<< "\n\tError Message: " << error.error_message(); |
|
|
|
extendee_type.c_str(), error.error_code(), |
|
|
|
|
|
|
|
error.error_message().c_str()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
return false; |
|
|
@ -278,16 +261,13 @@ bool ProtoReflectionDescriptorDatabase::GetServices( |
|
|
|
} else if (response.message_response_case() == |
|
|
|
} else if (response.message_response_case() == |
|
|
|
ServerReflectionResponse::MessageResponseCase::kErrorResponse) { |
|
|
|
ServerReflectionResponse::MessageResponseCase::kErrorResponse) { |
|
|
|
const ErrorResponse& error = response.error_response(); |
|
|
|
const ErrorResponse& error = response.error_response(); |
|
|
|
gpr_log(GPR_INFO, |
|
|
|
LOG(INFO) << "Error on GetServices()\n\tError code: " << error.error_code() |
|
|
|
"Error on GetServices()\n\tError code: %d\n" |
|
|
|
<< "\n\tError Message: " << error.error_message(); |
|
|
|
"\tError Message: %s", |
|
|
|
|
|
|
|
error.error_code(), error.error_message().c_str()); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
gpr_log( |
|
|
|
LOG(INFO) |
|
|
|
GPR_INFO, |
|
|
|
<< "Error on GetServices() response type\n\tExpecting: " |
|
|
|
"Error on GetServices() response type\n\tExpecting: %d\n\tReceived: %d", |
|
|
|
<< ServerReflectionResponse::MessageResponseCase::kListServicesResponse |
|
|
|
ServerReflectionResponse::MessageResponseCase::kListServicesResponse, |
|
|
|
<< "\n\tReceived: " << response.message_response_case(); |
|
|
|
response.message_response_case()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|