Add RTCCertificateStats cache to avoid rtc::SSLCertChain::GetStats.
Unlike the cache of the entire stats report which is time limited, this certificate cache is valid for an unlimited amount of time, but is cleared at ClearCachedStatsReport() which is already called on each SLD/SRD call. Since certificates can only change by negotiation, this cache is ensured to always be invalidated when certificates change. Since ClearCachedStatsReport() can happen for other reasons than certificates changing we may clear the cache more often then is necessary, but arguably this is seldom enough that we don't have to create a separate "ClearCertificateStats()" method. Keep it simple? The cache specifically avoids rtc::SSLCertChain::GetStats which trigger rtc::SSLCertificate::GetStats and rtc::Base64::EncodeFromArray. Bug: webrtc:14458 Change-Id: I5f95a4a5eb51cc4462147270fdae7bb9fb7bc822 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/276602 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/main@{#38205}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
4c7d3f82f9
commit
69d23c9386
@ -44,6 +44,12 @@ SSLCertificateStats::SSLCertificateStats(
|
||||
|
||||
SSLCertificateStats::~SSLCertificateStats() {}
|
||||
|
||||
std::unique_ptr<SSLCertificateStats> SSLCertificateStats::Copy() const {
|
||||
return std::make_unique<SSLCertificateStats>(
|
||||
std::string(fingerprint), std::string(fingerprint_algorithm),
|
||||
std::string(base64_certificate), issuer ? issuer->Copy() : nullptr);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// SSLCertificate
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -38,6 +38,8 @@ struct RTC_EXPORT SSLCertificateStats {
|
||||
std::string fingerprint_algorithm;
|
||||
std::string base64_certificate;
|
||||
std::unique_ptr<SSLCertificateStats> issuer;
|
||||
|
||||
std::unique_ptr<SSLCertificateStats> Copy() const;
|
||||
};
|
||||
|
||||
// Abstract interface overridden by SSL library specific
|
||||
|
||||
Reference in New Issue
Block a user