Skip to content
This repository has been archived by the owner on Aug 19, 2022. It is now read-only.

fix shadowing of service name #37

Merged
merged 1 commit into from
Jun 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion extapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (r *resourceManager) Stat() (result ResourceManagerStat) {
}
result.Services = make(map[string]network.ScopeStat, len(svcs))
for _, svc := range svcs {
result.Services[svc.name] = svc.Stat()
result.Services[svc.service] = svc.Stat()
}
result.Transient = r.transient.Stat()
result.System = r.system.Stat()
Expand Down
16 changes: 8 additions & 8 deletions rcmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ var _ network.ResourceScope = (*transientScope)(nil)
type serviceScope struct {
*resourceScope

name string
rcmgr *resourceManager
service string
rcmgr *resourceManager

peers map[peer.ID]*resourceScope
}
Expand Down Expand Up @@ -378,13 +378,13 @@ func newTransientScope(limit Limit, rcmgr *resourceManager) *transientScope {
}
}

func newServiceScope(name string, limit Limit, rcmgr *resourceManager) *serviceScope {
func newServiceScope(service string, limit Limit, rcmgr *resourceManager) *serviceScope {
return &serviceScope{
resourceScope: newResourceScope(limit,
[]*resourceScope{rcmgr.system.resourceScope},
fmt.Sprintf("service:%s", name), rcmgr.trace, rcmgr.metrics),
name: name,
rcmgr: rcmgr,
fmt.Sprintf("service:%s", service), rcmgr.trace, rcmgr.metrics),
service: service,
rcmgr: rcmgr,
}
}

Expand Down Expand Up @@ -431,7 +431,7 @@ func newStreamScope(dir network.Direction, limit Limit, peer *peerScope, rcmgr *
}

func (s *serviceScope) Name() string {
return s.name
return s.service
}

func (s *serviceScope) getPeerScope(p peer.ID) *resourceScope {
Expand All @@ -444,7 +444,7 @@ func (s *serviceScope) getPeerScope(p peer.ID) *resourceScope {
return ps
}

l := s.rcmgr.limits.GetServicePeerLimits(s.name)
l := s.rcmgr.limits.GetServicePeerLimits(s.service)

if s.peers == nil {
s.peers = make(map[peer.ID]*resourceScope)
Expand Down