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

Commit 631b50fc authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6206568 from d4e09734 to rvc-release

Change-Id: I75d6cf731f4aa9af0f9553dfea3be84ca8a111cf
parents 05be1c7d d4e09734
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@ namespace net {
// All methods are thread-safe and non-blocking.
class DnsTlsQueryMap {
  public:
    enum class Response : uint8_t { success, network_error, limit_error, internal_error };

    struct Query {
        // The new ID number assigned to this query.
        uint16_t newId;
@@ -41,8 +43,10 @@ class DnsTlsQueryMap {
        const netdutils::Slice query;
    };

    typedef DnsTlsServer::Response Response;
    typedef DnsTlsServer::Result Result;
    struct Result {
        Response code;
        std::vector<uint8_t> response;
    };

    struct QueryFuture {
        QueryFuture(Query query, std::future<Result> result)
+0 −7
Original line number Diff line number Diff line
@@ -37,13 +37,6 @@ struct DnsTlsServer {
    // Allow sockaddr_storage to be promoted to DnsTlsServer automatically.
    DnsTlsServer(const sockaddr_storage& ss) : ss(ss) {}

    enum class Response : uint8_t { success, network_error, limit_error, internal_error };

    struct Result {
        Response code;
        std::vector<uint8_t> response;
    };

    // The server location, including IP and port.
    sockaddr_storage ss = {};

+2 −2
Original line number Diff line number Diff line
@@ -46,8 +46,8 @@ class DnsTlsTransport : public IDnsTlsSocketObserver {
        : mMark(mark), mServer(server), mFactory(factory) {}
    ~DnsTlsTransport();

    typedef DnsTlsServer::Response Response;
    typedef DnsTlsServer::Result Result;
    using Response = DnsTlsQueryMap::Response;
    using Result = DnsTlsQueryMap::Result;

    // Given a |query|, this method sends it to the server and returns the result asynchronously.
    std::future<Result> query(const netdutils::Slice query) EXCLUDES(mLock);
+2 −2
Original line number Diff line number Diff line
@@ -180,9 +180,9 @@ TEST_F(TransportTest, IdReuse) {
    DnsTlsTransport transport(SERVER1, MARK, &factory);
    for (int i = 0; i < 100; ++i) {
        // Send a query.
        std::future<DnsTlsServer::Result> f = transport.query(makeSlice(QUERY));
        std::future<DnsTlsTransport::Result> f = transport.query(makeSlice(QUERY));
        // Wait for the response.
        DnsTlsServer::Result r = f.get();
        DnsTlsTransport::Result r = f.get();
        EXPECT_EQ(DnsTlsTransport::Response::success, r.code);

        // All queries should have an observed ID of zero, because it is returned to the ID pool