Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 439e6b53 authored by Bernie Innocenti's avatar Bernie Innocenti
Browse files

Merge remote-tracking branch 'rvc-dev-plus-aosp' into 'mainline-prod'

Change-Id: I7039a6ec870a75335f81305755e7368a0f386ba4
parents 102d3d32 16148eb6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ cc_library {
        "libstatslog_resolv",
        "libstatspush_compat",
        "libsysutils",
        "netd_event_listener_interface-ndk_platform",
        "netd_event_listener_interface-unstable-ndk_platform",
        "server_configurable_flags",
        "stats_proto",
    ],
@@ -268,7 +268,7 @@ cc_test {
    static_libs: [
        "dnsresolver_aidl_interface-unstable-ndk_platform",
        "netd_aidl_interface-ndk_platform",
        "netd_event_listener_interface-ndk_platform",
        "netd_event_listener_interface-unstable-ndk_platform",
        "libcutils",
        "libgmock",
        "libnetd_resolv",
+8 −1
Original line number Diff line number Diff line
@@ -20,9 +20,16 @@

#include <android-base/logging.h>

#include "Experiments.h"

namespace android {
namespace net {

DnsTlsQueryMap::DnsTlsQueryMap() {
    mMaxTries = Experiments::getInstance()->getFlag("dot_maxtries", kMaxTries);
    if (mMaxTries < 1) mMaxTries = 1;
}

std::unique_ptr<DnsTlsQueryMap::QueryFuture> DnsTlsQueryMap::recordQuery(
        const netdutils::Slice query) {
    std::lock_guard guard(mLock);
@@ -67,7 +74,7 @@ void DnsTlsQueryMap::cleanup() {
    std::lock_guard guard(mLock);
    for (auto it = mQueries.begin(); it != mQueries.end();) {
        auto& p = it->second;
        if (p.tries >= kMaxTries) {
        if (p.tries >= mMaxTries) {
            expire(&p);
            it = mQueries.erase(it);
        } else {
+3 −0
Original line number Diff line number Diff line
@@ -36,6 +36,8 @@ class DnsTlsQueryMap {
  public:
    enum class Response : uint8_t { success, network_error, limit_error, internal_error };

    DnsTlsQueryMap();

    struct Query {
        // The new ID number assigned to this query.
        uint16_t newId;
@@ -80,6 +82,7 @@ class DnsTlsQueryMap {

    // The maximum number of times we will send a query before abandoning it.
    static constexpr int kMaxTries = 3;
    int mMaxTries;

  private:
    std::mutex mLock;
+1 −1
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ bool AddressComparator::operator() (const DnsTlsServer& x, const DnsTlsServer& y

// Returns a tuple of references to the elements of s.
auto make_tie(const DnsTlsServer& s) {
    return std::tie(s.ss, s.name, s.protocol, s.connectTimeout);
    return std::tie(s.ss, s.name, s.protocol);
}

bool DnsTlsServer::operator <(const DnsTlsServer& other) const {
+0 −8
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

#pragma once

#include <chrono>
#include <set>
#include <string>
#include <vector>
@@ -51,13 +50,6 @@ struct DnsTlsServer {
    // Placeholder.  More protocols might be defined in the future.
    int protocol = IPPROTO_TCP;

    // The time to wait for the attempt on connecting to the server.
    // Set the default value 127 seconds to be consistent with TCP connect timeout.
    // (presume net.ipv4.tcp_syn_retries = 6)
    static constexpr std::chrono::milliseconds kDotConnectTimeoutMs =
            std::chrono::milliseconds(127 * 1000);
    std::chrono::milliseconds connectTimeout = kDotConnectTimeoutMs;

    // Exact comparison of DnsTlsServer objects
    bool operator<(const DnsTlsServer& other) const;
    bool operator==(const DnsTlsServer& other) const;
Loading