Commit 57a49f15 authored by Adin Schmahmann's avatar Adin Schmahmann

cleanup: fixed a few linter/vetting errors

parent 20f111c9
...@@ -387,6 +387,10 @@ func makeRoutingTable(dht *IpfsDHT, cfg config, maxLastSuccessfulOutboundThresho ...@@ -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) 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() cmgr := dht.host.ConnManager()
rt.PeerAdded = func(p peer.ID) { rt.PeerAdded = func(p peer.ID) {
...@@ -409,8 +413,8 @@ func makeRoutingTable(dht *IpfsDHT, cfg config, maxLastSuccessfulOutboundThresho ...@@ -409,8 +413,8 @@ func makeRoutingTable(dht *IpfsDHT, cfg config, maxLastSuccessfulOutboundThresho
} }
// GetRoutingTableDiversityStats returns the diversity stats for the Routing Table. // GetRoutingTableDiversityStats returns the diversity stats for the Routing Table.
func (d *IpfsDHT) GetRoutingTableDiversityStats() []peerdiversity.CplDiversityStats { func (dht *IpfsDHT) GetRoutingTableDiversityStats() []peerdiversity.CplDiversityStats {
return d.routingTable.GetDiversityStats() return dht.routingTable.GetDiversityStats()
} }
// Mode allows introspection of the operation mode of the DHT // 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) ...@@ -541,19 +545,19 @@ func (dht *IpfsDHT) getValueOrPeers(ctx context.Context, p peer.ID, key string)
// Perhaps we were given closer peers // Perhaps we were given closer peers
peers := pb.PBPeersToPeerInfos(pmes.GetCloserPeers()) peers := pb.PBPeersToPeerInfos(pmes.GetCloserPeers())
if record := pmes.GetRecord(); record != nil { if rec := pmes.GetRecord(); rec != nil {
// Success! We were given the value // Success! We were given the value
logger.Debug("got value") logger.Debug("got value")
// make sure record is valid. // make sure record is valid.
err = dht.Validator.Validate(string(record.GetKey()), record.GetValue()) err = dht.Validator.Validate(string(rec.GetKey()), rec.GetValue())
if err != nil { if err != nil {
logger.Debug("received invalid record (discarded)") logger.Debug("received invalid record (discarded)")
// return a sentinal to signify an invalid record was received // return a sentinal to signify an invalid record was received
err = errInvalidRecord err = errInvalidRecord
record = new(recpb.Record) rec = new(recpb.Record)
} }
return record, peers, err return rec, peers, err
} }
if len(peers) > 0 { if len(peers) > 0 {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment