Browse Source

don't compare peer IDs when hole punching

pull/1424/head
Marten Seemann 3 years ago
parent
commit
5ce0d8c8c6
  1. 2
      p2p/transport/quic/conn_test.go
  2. 5
      p2p/transport/quic/transport.go

2
p2p/transport/quic/conn_test.go

@ -377,7 +377,7 @@ var _ = Describe("Connection", func() {
connChan := make(chan tpt.CapableConn)
go func() {
defer GinkgoRecover()
conn, err := t2.Dial(n.WithSimultaneousConnect(context.Background(), ""), ln1.Multiaddr(), serverID)
conn, err := t2.Dial(context.Background(), ln1.Multiaddr(), serverID)
Expect(err).ToNot(HaveOccurred())
connChan <- conn
}()

5
p2p/transport/quic/transport.go

@ -1,7 +1,6 @@
package libp2pquic
import (
"bytes"
"context"
"errors"
"fmt"
@ -179,9 +178,7 @@ func (t *transport) Dial(ctx context.Context, raddr ma.Multiaddr, p peer.ID) (tp
tlsConf, keyCh := t.identity.ConfigForPeer(p)
if simConnect, _ := n.GetSimultaneousConnect(ctx); simConnect {
if bytes.Compare([]byte(t.localPeer), []byte(p)) < 0 {
return t.holePunch(ctx, network, addr, p)
}
return t.holePunch(ctx, network, addr, p)
}
pconn, err := t.connManager.Dial(network, addr)

Loading…
Cancel
Save