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
dms3
go-unixfs
Commits
71ec4f91
Commit
71ec4f91
authored
10 years ago
by
Juan Batiz-Benet
Committed by
Brian Tiger Chow
10 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop -> CloseConnection
parent
d934806e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
5 deletions
+5
-5
routing/dht/dht.go
routing/dht/dht.go
+2
-2
swarm/interface.go
swarm/interface.go
+1
-1
swarm/swarm.go
swarm/swarm.go
+2
-2
No files found.
routing/dht/dht.go
View file @
71ec4f91
...
...
@@ -521,7 +521,7 @@ func (dht *IpfsDHT) putLocal(key u.Key, value []byte) error {
func
(
dht
*
IpfsDHT
)
Update
(
p
*
peer
.
Peer
)
{
for
_
,
route
:=
range
dht
.
routingTables
{
removed
:=
route
.
Update
(
p
)
// Only
drop
the connection if no tables refer to this peer
// Only
close
the connection if no tables refer to this peer
if
removed
!=
nil
{
found
:=
false
for
_
,
r
:=
range
dht
.
routingTables
{
...
...
@@ -531,7 +531,7 @@ func (dht *IpfsDHT) Update(p *peer.Peer) {
}
}
if
!
found
{
dht
.
network
.
Drop
(
removed
)
dht
.
network
.
CloseConnection
(
removed
)
}
}
}
...
...
This diff is collapsed.
Click to expand it.
swarm/interface.go
View file @
71ec4f91
...
...
@@ -16,5 +16,5 @@ type Network interface {
GetErrChan
()
chan
error
GetChannel
(
PBWrapper_MessageType
)
*
Chan
Close
()
Drop
(
*
peer
.
Peer
)
error
CloseConnection
(
*
peer
.
Peer
)
error
}
This diff is collapsed.
Click to expand it.
swarm/swarm.go
View file @
71ec4f91
...
...
@@ -467,8 +467,8 @@ func (s *Swarm) ConnectNew(addr *ma.Multiaddr) (*peer.Peer, error) {
return
npeer
,
err
}
//
R
emoves a given peer from
the
swarm
and
closes connection
s to it
func
(
s
*
Swarm
)
Drop
(
p
*
peer
.
Peer
)
error
{
//
CloseConnection r
emoves a given peer from swarm
+
closes
the
connection
func
(
s
*
Swarm
)
CloseConnection
(
p
*
peer
.
Peer
)
error
{
u
.
DOut
(
"Dropping peer: [%s]
\n
"
,
p
.
ID
.
Pretty
())
s
.
connsLock
.
RLock
()
conn
,
found
:=
s
.
conns
[
u
.
Key
(
p
.
ID
)]
...
...
This diff is collapsed.
Click to expand it.
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