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

Commit cdb5bbc9 authored by Mike Yu's avatar Mike Yu
Browse files

Test: Some comments and small fixes for PrivateDnsDohTest

This is a follow up change of aosp/2428978. Also fix some minor
bugs in the test code.

Bug: 264966204
Test: atest
Change-Id: I5a0835c24e16c16ac3e740d1726adca9faabd8c3
parent 87c2e560
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -152,8 +152,9 @@ impl Client {

        if let Some(send_reset_stream) = send_reset_stream {
            if send_reset_stream == stream_id {
                // Terminate the stream with an error code 99.
                self.conn.stream_shutdown(stream_id, quiche::Shutdown::Write, 99)?;
                info!("Preparing RESET_FRAME on stream {}", stream_id);
                info!("Preparing RESET_STREAM on stream {}", stream_id);
                return Ok(());
            }
        }
+6 −12
Original line number Diff line number Diff line
@@ -62,8 +62,7 @@ bool DohFrontend::stopServer() {
    std::lock_guard guard(mMutex);
    if (!mRustDoh) return false;

    rust::frontend_stop(mRustDoh);
    return true;
    return rust::frontend_stop(mRustDoh);
}

int DohFrontend::queries() const {
@@ -130,40 +129,35 @@ bool DohFrontend::setMaxIdleTimeout(uint64_t value) {
    std::lock_guard guard(mMutex);
    if (!mRustDoh) return false;

    frontend_set_max_idle_timeout(mRustDoh, value);
    return true;
    return frontend_set_max_idle_timeout(mRustDoh, value);
}

bool DohFrontend::setMaxBufferSize(uint64_t value) {
    std::lock_guard guard(mMutex);
    if (!mRustDoh) return false;

    frontend_set_max_buffer_size(mRustDoh, value);
    return true;
    return frontend_set_max_buffer_size(mRustDoh, value);
}

bool DohFrontend::setMaxStreamsBidi(uint64_t value) {
    std::lock_guard guard(mMutex);
    if (!mRustDoh) return false;

    frontend_set_max_streams_bidi(mRustDoh, value);
    return true;
    return frontend_set_max_streams_bidi(mRustDoh, value);
}

bool DohFrontend::block_sending(bool block) {
    std::lock_guard guard(mMutex);
    if (!mRustDoh) return false;

    frontend_block_sending(mRustDoh, block);
    return true;
    return frontend_block_sending(mRustDoh, block);
}

bool DohFrontend::setResetStreamId(uint64_t value) {
    std::lock_guard guard(mMutex);
    if (!mRustDoh) return false;

    frontend_set_reset_stream_id(mRustDoh, value);
    return true;
    return frontend_set_reset_stream_id(mRustDoh, value);
}

bool DohFrontend::waitForAllClientsDisconnected() const {
+3 −1
Original line number Diff line number Diff line
@@ -1177,7 +1177,9 @@ TEST_F(PrivateDnsDohTest, ReceiveResetStream) {
    doh.clearQueries();
    dns.clearQueries();

    // The stream 0 has been used for DoH probe. The stream for the next DoH query will be 4.
    // DnsResolver uses bidirectional streams for DoH queries (See
    // RFC9000#name-stream-types-and-identifier), and stream 0 has been used for DoH probe, so
    // the next stream for the next DoH query will be 4.
    EXPECT_TRUE(doh.setResetStreamId(4));

    // Send a DNS request. The DoH query will be sent on stream 4 and fail.