Skip to content

Commit

Permalink
fix: cancel all outgoing requests when disconnect to prevent ANR
Browse files Browse the repository at this point in the history
  • Loading branch information
jyyi1 committed Feb 6, 2024
1 parent a6e4eca commit 302a01e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Android/app/src/go/intra/doh/doh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ import (
"encoding/binary"
"errors"
"io"
"io/ioutil"
"net"
"net/http"
"net/http/httptrace"
"net/url"
"reflect"
"testing"

"github.com/stretchr/testify/require"
"golang.org/x/net/dns/dnsmessage"
)

Expand Down Expand Up @@ -247,7 +247,7 @@ func TestRequest(t *testing.T) {
if req.URL.String() != testURL {
t.Errorf("URL mismatch: %s != %s", req.URL.String(), testURL)
}
reqBody, err := ioutil.ReadAll(req.Body)
reqBody, err := io.ReadAll(req.Body)
if err != nil {
t.Error(err)
}
Expand Down Expand Up @@ -889,3 +889,9 @@ func TestServfail(t *testing.T) {
t.Errorf("Wrong question: %v", servfail.Questions[0])
}
}

func TestQueryCanBeCancelled(t *testing.T) {
server, err := net.ListenTCP("tcp", &net.TCPAddr{IP: net.IPv4(127, 0, 0, 1)})
require.NoError(t, err)
defer server.Close()
}

0 comments on commit 302a01e

Please sign in to comment.