aboutsummaryrefslogtreecommitdiffstats
path: root/p2p
diff options
context:
space:
mode:
authorViktor TrĂ³n <viktor.tron@gmail.com>2018-07-24 14:44:43 +0800
committerGitHub <noreply@github.com>2018-07-24 14:44:43 +0800
commitb536460f8e4166e1a884fd30290b56a85289503f (patch)
tree4630a130bad7ec02412a6df673313d2fbac71893 /p2p
parentafd8b847060eed094cd7c6e0d133338a33cf4631 (diff)
parent14bdcdeab448885d22e516933f59096311c19672 (diff)
downloaddexon-b536460f8e4166e1a884fd30290b56a85289503f.tar
dexon-b536460f8e4166e1a884fd30290b56a85289503f.tar.gz
dexon-b536460f8e4166e1a884fd30290b56a85289503f.tar.bz2
dexon-b536460f8e4166e1a884fd30290b56a85289503f.tar.lz
dexon-b536460f8e4166e1a884fd30290b56a85289503f.tar.xz
dexon-b536460f8e4166e1a884fd30290b56a85289503f.tar.zst
dexon-b536460f8e4166e1a884fd30290b56a85289503f.zip
Merge pull request #17231 from ethersphere/develop
swarm: client-side MRU signatures ; BMT fixes ; network simulation tests
Diffstat (limited to 'p2p')
-rw-r--r--p2p/simulations/adapters/inproc.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/p2p/simulations/adapters/inproc.go b/p2p/simulations/adapters/inproc.go
index b68d08f39..c1b032a0d 100644
--- a/p2p/simulations/adapters/inproc.go
+++ b/p2p/simulations/adapters/inproc.go
@@ -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()