Automated rollback of commit fb44656f73e1aeff2a559225b1add8f40a7ddf23. *** Reason for rollback *** 50% regression in client startup time PiperOrigin-RevId: 212887247
diff --git a/src/main/cpp/blaze.cc b/src/main/cpp/blaze.cc index cd63a80..98e6c20 100644 --- a/src/main/cpp/blaze.cc +++ b/src/main/cpp/blaze.cc
@@ -1595,19 +1595,6 @@ static void null_grpc_log_function(gpr_log_func_args *args) {} -// There might be a mismatch between std::string and the string type returned -// from protos. This function is the safe way to compare such strings. -template <typename StringTypeA, typename StringTypeB> -static bool ProtoStringEqual(const StringTypeA &cookieA, - const StringTypeB &cookieB) { - // use strncmp insted of strcmp to deal with null bytes in the cookie. - auto cookie_length = cookieA.size(); - if (cookie_length != cookieB.size()) { - return false; - } - return strncmp(cookieA.c_str(), cookieB.c_str(), cookie_length) == 0; -} - GrpcBlazeServer::GrpcBlazeServer(int connect_timeout_secs) { connected_ = false; connect_timeout_secs_ = connect_timeout_secs; @@ -1640,7 +1627,7 @@ << connect_timeout_secs_ << " secs)..."; grpc::Status status = client->Ping(&context, request, &response); - if (!status.ok() || !ProtoStringEqual(response.cookie(), response_cookie_)) { + if (!status.ok() || response.cookie() != response_cookie_) { BAZEL_LOG(INFO) << "Connection to server failed: " << status.error_message().c_str(); return false; @@ -1918,7 +1905,7 @@ finished_warning_emitted = true; } - if (!ProtoStringEqual(response.cookie(), response_cookie_)) { + if (response.cookie() != response_cookie_) { BAZEL_LOG(USER) << "\nServer response cookie invalid, exiting"; return blaze_exit_code::INTERNAL_ERROR; }