Merge pull request #17231 from ethersphere/develop

swarm: client-side MRU signatures ; BMT fixes ; network simulation tests
This commit is contained in:
Viktor Trón
2018-07-24 08:44:43 +02:00
committed by GitHub
50 changed files with 6893 additions and 1969 deletions

View File

@ -296,6 +296,13 @@ func (sn *SimNode) Stop() error {
return sn.node.Stop()
}
// Service returns a running service by name
func (sn *SimNode) Service(name string) node.Service {
sn.lock.RLock()
defer sn.lock.RUnlock()
return sn.running[name]
}
// Services returns a copy of the underlying services
func (sn *SimNode) Services() []node.Service {
sn.lock.RLock()
@ -307,6 +314,17 @@ func (sn *SimNode) Services() []node.Service {
return services
}
// ServiceMap returns a map by names of the underlying services
func (sn *SimNode) ServiceMap() map[string]node.Service {
sn.lock.RLock()
defer sn.lock.RUnlock()
services := make(map[string]node.Service, len(sn.running))
for name, service := range sn.running {
services[name] = service
}
return services
}
// Server returns the underlying p2p.Server
func (sn *SimNode) Server() *p2p.Server {
return sn.node.Server()