Browse Source

don't call InterceptAccept when dialing

pull/1424/head
Marten Seemann 4 years ago
parent
commit
f9838545ca
  1. 2
      p2p/transport/quic/conn_test.go
  2. 2
      p2p/transport/quic/transport.go

2
p2p/transport/quic/conn_test.go

@ -209,7 +209,6 @@ var _ = Describe("Connection", func() {
defer ln.Close()
cg := NewMockConnectionGater(mockCtrl)
cg.EXPECT().InterceptAccept(gomock.Any()).Return(true)
cg.EXPECT().InterceptSecured(gomock.Any(), gomock.Any(), gomock.Any())
clientTransport, err := NewTransport(clientKey, nil, cg)
@ -221,7 +220,6 @@ var _ = Describe("Connection", func() {
Expect(err.Error()).To(ContainSubstring("connection gated"))
// now allow the peerId and make sure the connection goes through
cg.EXPECT().InterceptAccept(gomock.Any()).Return(true)
cg.EXPECT().InterceptSecured(gomock.Any(), gomock.Any(), gomock.Any()).Return(true)
clientTransport.(*transport).clientConfig.HandshakeTimeout = 2 * time.Second
conn, err := clientTransport.Dial(context.Background(), ln.Multiaddr(), serverID)

2
p2p/transport/quic/transport.go

@ -194,7 +194,7 @@ func (t *transport) Dial(ctx context.Context, raddr ma.Multiaddr, p peer.ID) (tp
remotePeerID: p,
remoteMultiaddr: remoteMultiaddr,
}
if t.gater != nil && !(t.gater.InterceptAccept(conn) && t.gater.InterceptSecured(n.DirOutbound, p, conn)) {
if t.gater != nil && !t.gater.InterceptSecured(n.DirOutbound, p, conn) {
sess.CloseWithError(errorCodeConnectionGating, "connection gated")
return nil, fmt.Errorf("secured connection gated")
}

Loading…
Cancel
Save