In QUIC TlsServerHandshaker, only run DefaultSignatureCallback at most once.
Protected by FLAGS_quic_reloadable_flag_quic_run_default_signature_callback_once.
PiperOrigin-RevId: 385179619
diff --git a/quic/core/quic_flags_list.h b/quic/core/quic_flags_list.h
index 8abba28..90b14fb 100644
--- a/quic/core/quic_flags_list.h
+++ b/quic/core/quic_flags_list.h
@@ -23,6 +23,8 @@
QUIC_FLAG(FLAGS_quic_restart_flag_quic_support_release_time_for_gso, false)
// If true, QuicIdleNetworkDetector::SetAlarm will become a noop if dectection has been stopped by QuicIdleNetworkDetector::StopDetection.
QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_idle_network_detector_no_alarm_after_stopped, false)
+// If true, TlsServerHandshaker::DefaultProofSourceHandle::DefaultSignatureCallback will run at most once.
+QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_run_default_signature_callback_once, false)
// If true, abort async QPACK header decompression in QuicSpdyStream::Reset() and in QuicSpdyStream::OnStreamReset().
QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_abort_qpack_on_stream_reset, true)
// If true, ack frequency frame can be sent from server to client.
diff --git a/quic/core/tls_server_handshaker.h b/quic/core/tls_server_handshaker.h
index e9fc172..9ea70a6 100644
--- a/quic/core/tls_server_handshaker.h
+++ b/quic/core/tls_server_handshaker.h
@@ -19,6 +19,7 @@
#include "quic/core/quic_types.h"
#include "quic/core/tls_handshaker.h"
#include "quic/platform/api/quic_export.h"
+#include "quic/platform/api/quic_flag_utils.h"
#include "quic/platform/api/quic_flags.h"
namespace quic {
@@ -254,6 +255,20 @@
// Operation has been canceled, or Run has been called.
return;
}
+
+ if (GetQuicReloadableFlag(quic_run_default_signature_callback_once)) {
+ QUIC_RELOADABLE_FLAG_COUNT(quic_run_default_signature_callback_once);
+ DefaultProofSourceHandle* handle = handle_;
+ handle_ = nullptr;
+
+ handle->signature_callback_ = nullptr;
+ if (handle->handshaker_ != nullptr) {
+ handle->handshaker_->OnComputeSignatureDone(
+ ok, is_sync_, std::move(signature), std::move(details));
+ }
+ return;
+ }
+
handle_->signature_callback_ = nullptr;
if (handle_->handshaker_ != nullptr) {
handle_->handshaker_->OnComputeSignatureDone(