swarm/network: Change hive Healthy func to accept addresses

This commit is contained in:
lash 2018-12-17 11:28:12 +01:00
parent 5bf8307719
commit 166f08403a
2 changed files with 8 additions and 4 deletions

View file

@ -244,7 +244,10 @@ func (h *Hive) savePeers() error {
} }
// Healthy is an api proxy to the underlying kademlia healthy function // Healthy is an api proxy to the underlying kademlia healthy function
func (h *Hive) Healthy(addr []byte, pp PeerPot) *Health { func (h *Hive) Healthy(addrs [][]byte) *Health {
pp.base = addr k := NewKademlia(h.BaseAddr(), NewKadParams())
return pp.Healthy() for _, a := range addrs {
k.On(a)
}
return pp.Healthy([]*Kademlia{k})
} }

View file

@ -412,7 +412,8 @@ func discoveryPersistenceSimulation(nodes, conns int, adapter adapters.NodeAdapt
addr := id.String() addr := id.String()
log.Error("before hive healthy call") log.Error("before hive healthy call")
pp := ppmap[addr] pp := ppmap[addr]
if err := client.Call(&healthy, "hive_healthy", pp.BaseAddr(), pp); err != nil { // if err := client.Call(&healthy, "hive_healthy", pp.BaseAddr(), pp); err != nil {
if err := client.Call(&healthy, "hive_healthy", pp.BaseAddr(), addrs); err != nil {
return fmt.Errorf("error getting node health: %s", err) return fmt.Errorf("error getting node health: %s", err)
} }