Skip to content

Commit

Permalink
fix missing private address reset after auto relay test
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Dec 3, 2021
1 parent 89fa368 commit 53eefca
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions p2p/host/autorelay/autorelay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ func connect(t *testing.T, a, b host.Host) {

// and the actual test!
func TestAutoRelay(t *testing.T) {
private4 := manet.Private4
t.Cleanup(func() { manet.Private4 = private4 })
manet.Private4 = []*net.IPNet{}

t.Run("with a circuitv1 relay", func(t *testing.T) {
Expand Down Expand Up @@ -163,6 +165,7 @@ func testAutoRelay(t *testing.T, useRelayv2 bool) {
if err != nil {
t.Fatal(err)
}
defer relayHost.Close()

// instantiate the relay
if useRelayv2 {
Expand Down Expand Up @@ -192,15 +195,18 @@ func testAutoRelay(t *testing.T, useRelayv2 bool) {
if err != nil {
t.Fatal(err)
}
defer h1.Close()

h2, err := libp2p.New(libp2p.EnableRelay(), libp2p.EnableAutoRelay(), libp2p.Routing(makePeerRouting))
if err != nil {
t.Fatal(err)
}
defer h2.Close()
h3, err := libp2p.New(libp2p.EnableRelay())
if err != nil {
t.Fatal(err)
}
defer h3.Close()

// verify that we don't advertise relay addrs initially
for _, addr := range h2.Addrs() {
Expand Down

0 comments on commit 53eefca

Please sign in to comment.