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
0773e584
Commit
0773e584
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
updated Update function
parent
3ae70217
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
routing/dht/dht.go
routing/dht/dht.go
+12
-11
No files found.
routing/dht/dht.go
View file @
0773e584
...
...
@@ -302,24 +302,25 @@ func (dht *IpfsDHT) putLocal(key u.Key, value []byte) error {
return
dht
.
datastore
.
Put
(
ds
.
NewKey
(
string
(
key
)),
value
)
}
// Update TODO(chas) Document this function
// Update signals to all routingTables to Update their last-seen status
// on the given peer.
func
(
dht
*
IpfsDHT
)
Update
(
p
*
peer
.
Peer
)
{
removedCount
:=
0
for
_
,
route
:=
range
dht
.
routingTables
{
removed
:=
route
.
Update
(
p
)
// Only close the connection if no tables refer to this peer
if
removed
!=
nil
{
found
:=
false
for
_
,
r
:=
range
dht
.
routingTables
{
if
r
.
Find
(
removed
.
ID
)
!=
nil
{
found
=
true
break
}
}
if
!
found
{
dht
.
network
.
CloseConnection
(
removed
)
}
removedCount
++
}
}
// Only close the connection if no tables refer to this peer
// if removedCount == len(dht.routingTables) {
// dht.network.ClosePeer(p)
// }
// ACTUALLY, no, let's not just close the connection. it may be connected
// due to other things. it seems that we just need connection timeouts
// after some deadline of inactivity.
}
// Find looks for a peer with a given ID connected to this dht and returns the peer and the table it was found in.
...
...
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