Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-swarm
Commits
e6dd8fb3
Unverified
Commit
e6dd8fb3
authored
May 29, 2021
by
Marten Seemann
Committed by
GitHub
May 29, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #260 from libp2p/remove-incorrect-gating
remove incorrect call to InterceptAddrDial
parents
fbd1280e
f004a103
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
10 deletions
+9
-10
swarm.go
swarm.go
+0
-10
swarm_test.go
swarm_test.go
+9
-0
No files found.
swarm.go
View file @
e6dd8fb3
...
...
@@ -212,16 +212,6 @@ func (s *Swarm) addConn(tc transport.CapableConn, dir network.Direction) (*Conn,
addr
=
tc
.
RemoteMultiaddr
()
)
if
s
.
gater
!=
nil
{
if
allow
:=
s
.
gater
.
InterceptAddrDial
(
p
,
addr
);
!
allow
{
err
:=
tc
.
Close
()
if
err
!=
nil
{
log
.
Warnf
(
"failed to close connection with peer %s and addr %s; err: %s"
,
p
.
Pretty
(),
addr
,
err
)
}
return
nil
,
ErrAddrFiltered
}
}
// create the Stat object, initializing with the underlying connection Stat if available
var
stat
network
.
Stat
if
cs
,
ok
:=
tc
.
(
network
.
ConnStat
);
ok
{
...
...
swarm_test.go
View file @
e6dd8fb3
...
...
@@ -317,6 +317,15 @@ func TestConnectionGating(t *testing.T) {
p2ConnectednessToP1
:
network
.
NotConnected
,
isP1OutboundErr
:
true
,
},
"p2 accepts inbound peer dial if outgoing dial is gated"
:
{
p2Gater
:
func
(
c
*
MockConnectionGater
)
*
MockConnectionGater
{
c
.
Dial
=
func
(
peer
.
ID
,
ma
.
Multiaddr
)
bool
{
return
false
}
return
c
},
p1ConnectednessToP2
:
network
.
Connected
,
p2ConnectednessToP1
:
network
.
Connected
,
isP1OutboundErr
:
false
,
},
"p2 gates inbound peer dial before securing"
:
{
p2Gater
:
func
(
c
*
MockConnectionGater
)
*
MockConnectionGater
{
c
.
Accept
=
func
(
c
network
.
ConnMultiaddrs
)
bool
{
return
false
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment