Add `--ignore_errors` option to quic_client. When running with `--num_requests` any error aborts quic_client invocation. It is inconvenient for one of my test scripts, where requests are hitting multiple hosts and one of them could be unavailable at the moment. Protected by FLAGS_ignore_errors. PiperOrigin-RevId: 536496328
diff --git a/quiche/quic/tools/quic_toy_client.cc b/quiche/quic/tools/quic_toy_client.cc index 21c85d7..4230ab3 100644 --- a/quiche/quic/tools/quic_toy_client.cc +++ b/quiche/quic/tools/quic_toy_client.cc
@@ -147,6 +147,10 @@ int32_t, num_requests, 1, "How many sequential requests to make on a single connection."); +DEFINE_QUICHE_COMMAND_LINE_FLAG(bool, ignore_errors, false, + "If true, ignore connection/response errors " + "and send all num_requests anyway."); + DEFINE_QUICHE_COMMAND_LINE_FLAG( bool, disable_certificate_verification, false, "If true, don't verify the server certificate."); @@ -504,7 +508,9 @@ std::cerr << "Request caused connection failure. Error: " << quic::QuicErrorCodeToString(client->session()->error()) << std::endl; - return 1; + if (!quiche::GetQuicheCommandLineFlag(FLAGS_ignore_errors)) { + return 1; + } } int response_code = client->latest_response_code(); @@ -517,11 +523,15 @@ } else { std::cout << "Request failed (redirect " << response_code << ")." << std::endl; - return 1; + if (!quiche::GetQuicheCommandLineFlag(FLAGS_ignore_errors)) { + return 1; + } } } else { std::cout << "Request failed (" << response_code << ")." << std::endl; - return 1; + if (!quiche::GetQuicheCommandLineFlag(FLAGS_ignore_errors)) { + return 1; + } } if (i + 1 < num_requests) { // There are more requests to perform. @@ -536,7 +546,9 @@ if (!client->Connect()) { std::cerr << "Failed to reconnect client between requests." << std::endl; - return 1; + if (!quiche::GetQuicheCommandLineFlag(FLAGS_ignore_errors)) { + return 1; + } } } else if (!quiche::GetQuicheCommandLineFlag( FLAGS_disable_port_changes)) {