Loading PrivateDnsConfiguration.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,10 @@ int PrivateDnsConfiguration::set(int32_t netId, uint32_t mark, mPrivateDnsTransports.erase(netId); resolv_stats_set_servers_for_dot(netId, {}); mPrivateDnsValidateThreads.erase(netId); // TODO: As mPrivateDnsValidateThreads is reset, validation threads which haven't yet // finished are considered outdated. Consider signaling the outdated validation threads to // stop them from updating the state of PrivateDnsConfiguration (possibly disallow them to // report onPrivateDnsValidationEvent). return 0; } Loading tests/dns_metrics_listener/dns_metrics_listener.h +7 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,13 @@ class DnsMetricsListener : public BaseMetricsListener { // Wait for the expected private DNS validation result until timeout. bool waitForPrivateDnsValidation(const std::string& serverAddr, const bool validated); // Return true if a validation result for |serverAddr| is found; otherwise, return false. // Only exists for testing. bool findValidationRecord(const std::string& serverAddr) const EXCLUDES(mMutex) { std::lock_guard lock(mMutex); return mValidationRecords.find({mNetId, serverAddr}) != mValidationRecords.end(); } private: typedef std::pair<int32_t, std::string> ServerKey; Loading tests/dns_responder/dns_tls_frontend.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -200,6 +200,7 @@ void DnsTlsFrontend::requestHandler() { break; } accept_connection_count_++; if (hangOnHandshake_) { LOG(DEBUG) << "TEST ONLY: unresponsive to SSL handshake"; Loading tests/dns_responder/dns_tls_frontend.h +2 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ class DnsTlsFrontend { int queries() const { return queries_; } void clearQueries() { queries_ = 0; } bool waitForQueries(int expected_count) const; int acceptConnectionsCount() const { return accept_connection_count_; } void set_chain_length(int length) { chain_length_ = length; } void setHangOnHandshakeForTesting(bool hangOnHandshake) { hangOnHandshake_ = hangOnHandshake; } Loading Loading @@ -88,6 +89,7 @@ class DnsTlsFrontend { // Eventfd used to signal for the handler thread termination. android::base::unique_fd event_fd_; std::atomic<int> queries_ = 0; std::atomic<int> accept_connection_count_ = 0; std::thread handler_thread_ GUARDED_BY(update_mutex_); std::mutex update_mutex_; int chain_length_ = 1; Loading tests/resolv_integration_test.cpp +399 −64 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
PrivateDnsConfiguration.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,10 @@ int PrivateDnsConfiguration::set(int32_t netId, uint32_t mark, mPrivateDnsTransports.erase(netId); resolv_stats_set_servers_for_dot(netId, {}); mPrivateDnsValidateThreads.erase(netId); // TODO: As mPrivateDnsValidateThreads is reset, validation threads which haven't yet // finished are considered outdated. Consider signaling the outdated validation threads to // stop them from updating the state of PrivateDnsConfiguration (possibly disallow them to // report onPrivateDnsValidationEvent). return 0; } Loading
tests/dns_metrics_listener/dns_metrics_listener.h +7 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,13 @@ class DnsMetricsListener : public BaseMetricsListener { // Wait for the expected private DNS validation result until timeout. bool waitForPrivateDnsValidation(const std::string& serverAddr, const bool validated); // Return true if a validation result for |serverAddr| is found; otherwise, return false. // Only exists for testing. bool findValidationRecord(const std::string& serverAddr) const EXCLUDES(mMutex) { std::lock_guard lock(mMutex); return mValidationRecords.find({mNetId, serverAddr}) != mValidationRecords.end(); } private: typedef std::pair<int32_t, std::string> ServerKey; Loading
tests/dns_responder/dns_tls_frontend.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -200,6 +200,7 @@ void DnsTlsFrontend::requestHandler() { break; } accept_connection_count_++; if (hangOnHandshake_) { LOG(DEBUG) << "TEST ONLY: unresponsive to SSL handshake"; Loading
tests/dns_responder/dns_tls_frontend.h +2 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ class DnsTlsFrontend { int queries() const { return queries_; } void clearQueries() { queries_ = 0; } bool waitForQueries(int expected_count) const; int acceptConnectionsCount() const { return accept_connection_count_; } void set_chain_length(int length) { chain_length_ = length; } void setHangOnHandshakeForTesting(bool hangOnHandshake) { hangOnHandshake_ = hangOnHandshake; } Loading Loading @@ -88,6 +89,7 @@ class DnsTlsFrontend { // Eventfd used to signal for the handler thread termination. android::base::unique_fd event_fd_; std::atomic<int> queries_ = 0; std::atomic<int> accept_connection_count_ = 0; std::thread handler_thread_ GUARDED_BY(update_mutex_); std::mutex update_mutex_; int chain_length_ = 1; Loading
tests/resolv_integration_test.cpp +399 −64 File changed.Preview size limit exceeded, changes collapsed. Show changes