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-kad-dht
Commits
57a49f15
Commit
57a49f15
authored
Aug 13, 2020
by
Adin Schmahmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup: fixed a few linter/vetting errors
parent
20f111c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
dht.go
dht.go
+10
-6
No files found.
dht.go
View file @
57a49f15
...
...
@@ -387,6 +387,10 @@ func makeRoutingTable(dht *IpfsDHT, cfg config, maxLastSuccessfulOutboundThresho
}
rt
,
err
:=
kb
.
NewRoutingTable
(
cfg
.
bucketSize
,
dht
.
selfKey
,
time
.
Minute
,
dht
.
host
.
Peerstore
(),
maxLastSuccessfulOutboundThreshold
,
filter
)
if
err
!=
nil
{
return
nil
,
err
}
cmgr
:=
dht
.
host
.
ConnManager
()
rt
.
PeerAdded
=
func
(
p
peer
.
ID
)
{
...
...
@@ -409,8 +413,8 @@ func makeRoutingTable(dht *IpfsDHT, cfg config, maxLastSuccessfulOutboundThresho
}
// GetRoutingTableDiversityStats returns the diversity stats for the Routing Table.
func
(
d
*
IpfsDHT
)
GetRoutingTableDiversityStats
()
[]
peerdiversity
.
CplDiversityStats
{
return
d
.
routingTable
.
GetDiversityStats
()
func
(
d
ht
*
IpfsDHT
)
GetRoutingTableDiversityStats
()
[]
peerdiversity
.
CplDiversityStats
{
return
d
ht
.
routingTable
.
GetDiversityStats
()
}
// Mode allows introspection of the operation mode of the DHT
...
...
@@ -541,19 +545,19 @@ func (dht *IpfsDHT) getValueOrPeers(ctx context.Context, p peer.ID, key string)
// Perhaps we were given closer peers
peers
:=
pb
.
PBPeersToPeerInfos
(
pmes
.
GetCloserPeers
())
if
rec
ord
:=
pmes
.
GetRecord
();
rec
ord
!=
nil
{
if
rec
:=
pmes
.
GetRecord
();
rec
!=
nil
{
// Success! We were given the value
logger
.
Debug
(
"got value"
)
// make sure record is valid.
err
=
dht
.
Validator
.
Validate
(
string
(
rec
ord
.
GetKey
()),
rec
ord
.
GetValue
())
err
=
dht
.
Validator
.
Validate
(
string
(
rec
.
GetKey
()),
rec
.
GetValue
())
if
err
!=
nil
{
logger
.
Debug
(
"received invalid record (discarded)"
)
// return a sentinal to signify an invalid record was received
err
=
errInvalidRecord
rec
ord
=
new
(
recpb
.
Record
)
rec
=
new
(
recpb
.
Record
)
}
return
rec
ord
,
peers
,
err
return
rec
,
peers
,
err
}
if
len
(
peers
)
>
0
{
...
...
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