Fix TSAN attempt

pull/13364/head
ncteisen 7 years ago
parent 9e2be4998e
commit f852c06038
  1. 9
      src/core/lib/transport/error_utils.cc
  2. 6
      src/core/lib/transport/error_utils.h

@ -43,7 +43,7 @@ static grpc_error* recursively_find_error_with_field(grpc_error* error,
void grpc_error_get_status(grpc_exec_ctx* exec_ctx, grpc_error* error,
grpc_millis deadline, grpc_status_code* code,
grpc_slice* slice, grpc_http2_error_code* http_error,
const char** full_error_details) {
const char** error_string) {
// Start with the parent error and recurse through the tree of children
// until we find the first one that has a status code.
grpc_error* found_error =
@ -70,8 +70,11 @@ void grpc_error_get_status(grpc_exec_ctx* exec_ctx, grpc_error* error,
}
if (code != nullptr) *code = status;
if (full_error_details != NULL && status != GRPC_STATUS_OK) {
*full_error_details = gpr_strdup(grpc_error_string(error));
if (error_string != NULL && status != GRPC_STATUS_OK) {
const char* str = grpc_error_string(error);
if (str != nullptr) {
*error_string = gpr_strdup(str);
}
}
if (http_error != nullptr) {

@ -30,15 +30,15 @@ extern "C" {
/// A utility function to get the status code and message to be returned
/// to the application. If not set in the top-level message, looks
/// through child errors until it finds the first one with these attributes.
/// All attributes are pulled from the same child error. full_error_details will
/// All attributes are pulled from the same child error. error_string will
/// be populated with the entire error string. If any of the attributes (code,
/// msg, http_status, full_error_details) are unneeded, they can be passed as
/// msg, http_status, error_string) are unneeded, they can be passed as
/// NULL.
void grpc_error_get_status(grpc_exec_ctx* exec_ctx, grpc_error* error,
grpc_millis deadline, grpc_status_code* code,
grpc_slice* slice,
grpc_http2_error_code* http_status,
const char** full_error_details);
const char** error_string);
/// A utility function to check whether there is a clear status code that
/// doesn't need to be guessed in \a error. This means that \a error or some

Loading…
Cancel
Save