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

don't compare peer IDs when hole punching #210

Merged
merged 1 commit into from
Jul 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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