Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #210 from libp2p/coordinate-hole-punch
Browse files Browse the repository at this point in the history
don't compare peer IDs when hole punching
  • Loading branch information
marten-seemann authored Jul 7, 2021
2 parents 38ad660 + 87927dd commit 6304588
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}()
Expand Down
5 changes: 1 addition & 4 deletions transport.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package libp2pquic

import (
"bytes"
"context"
"errors"
"fmt"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 6304588

Please sign in to comment.