diff --git a/cmd/cgr-engine/cgr-engine.go b/cmd/cgr-engine/cgr-engine.go index 5dc2742f1..842b39e60 100644 --- a/cmd/cgr-engine/cgr-engine.go +++ b/cmd/cgr-engine/cgr-engine.go @@ -140,43 +140,43 @@ func runCGREngine(fs []string) (err error) { // ServiceIndexer will share service references to all services srvIdxr := servmanager.NewServiceIndexer() - gvS := services.NewGlobalVarS(cfg, srvDep, srvIdxr) + gvS := services.NewGlobalVarS(cfg, srvIdxr) dmS := services.NewDataDBService(cfg, connMgr, *flags.SetVersions, srvDep, srvIdxr) - sdbS := services.NewStorDBService(cfg, *flags.SetVersions, srvDep, srvIdxr) - cls := services.NewCommonListenerService(cfg, caps, clsCh, srvDep, srvIdxr) - anzS := services.NewAnalyzerService(cfg, clsCh, iFilterSCh, anzCh, srvDep, srvIdxr) - coreS := services.NewCoreService(cfg, caps, clsCh, anzCh, cpuPrfF, shdWg, srvDep, srvIdxr) - cacheS := services.NewCacheService(cfg, dmS, connMgr, clsCh, anzCh, coreS, srvDep, srvIdxr) - dspS := services.NewDispatcherService(cfg, dmS, cacheS, iFilterSCh, clsCh, connMgr, anzCh, srvDep, srvIdxr) - ldrs := services.NewLoaderService(cfg, dmS, iFilterSCh, clsCh, connMgr, anzCh, srvDep, srvIdxr) - efs := services.NewExportFailoverService(cfg, connMgr, clsCh, srvDep, srvIdxr) - adminS := services.NewAdminSv1Service(cfg, dmS, sdbS, iFilterSCh, clsCh, connMgr, anzCh, srvDep, srvIdxr) - sessionS := services.NewSessionService(cfg, dmS, iFilterSCh, clsCh, connMgr, anzCh, srvDep, srvIdxr) - attrS := services.NewAttributeService(cfg, dmS, cacheS, iFilterSCh, clsCh, anzCh, dspS, srvDep, srvIdxr) - chrgS := services.NewChargerService(cfg, dmS, cacheS, iFilterSCh, clsCh, connMgr, anzCh, srvDep, srvIdxr) - routeS := services.NewRouteService(cfg, dmS, cacheS, iFilterSCh, clsCh, connMgr, anzCh, srvDep, srvIdxr) + sdbS := services.NewStorDBService(cfg, *flags.SetVersions, srvIdxr) + cls := services.NewCommonListenerService(cfg, caps, clsCh, srvIdxr) + anzS := services.NewAnalyzerService(cfg, clsCh, iFilterSCh, anzCh, srvIdxr) + coreS := services.NewCoreService(cfg, caps, clsCh, anzCh, cpuPrfF, shdWg, srvIdxr) + cacheS := services.NewCacheService(cfg, dmS, connMgr, clsCh, anzCh, coreS, srvIdxr) + dspS := services.NewDispatcherService(cfg, dmS, cacheS, iFilterSCh, clsCh, connMgr, anzCh, srvIdxr) + ldrs := services.NewLoaderService(cfg, dmS, iFilterSCh, clsCh, connMgr, anzCh, srvIdxr) + efs := services.NewExportFailoverService(cfg, connMgr, clsCh, srvIdxr) + adminS := services.NewAdminSv1Service(cfg, dmS, sdbS, iFilterSCh, clsCh, connMgr, anzCh, srvIdxr) + sessionS := services.NewSessionService(cfg, dmS, iFilterSCh, clsCh, connMgr, anzCh, srvIdxr) + attrS := services.NewAttributeService(cfg, dmS, cacheS, iFilterSCh, clsCh, anzCh, dspS, srvIdxr) + chrgS := services.NewChargerService(cfg, dmS, cacheS, iFilterSCh, clsCh, connMgr, anzCh, srvIdxr) + routeS := services.NewRouteService(cfg, dmS, cacheS, iFilterSCh, clsCh, connMgr, anzCh, srvIdxr) resourceS := services.NewResourceService(cfg, dmS, cacheS, iFilterSCh, clsCh, connMgr, anzCh, srvDep, srvIdxr) trendS := services.NewTrendService(cfg, dmS, cacheS, iFilterSCh, clsCh, connMgr, anzCh, srvDep, srvIdxr) rankingS := services.NewRankingService(cfg, dmS, cacheS, iFilterSCh, clsCh, connMgr, anzCh, srvDep, srvIdxr) thS := services.NewThresholdService(cfg, dmS, cacheS, iFilterSCh, connMgr, clsCh, anzCh, srvDep, srvIdxr) stS := services.NewStatService(cfg, dmS, cacheS, iFilterSCh, clsCh, connMgr, anzCh, srvDep, srvIdxr) - erS := services.NewEventReaderService(cfg, iFilterSCh, connMgr, clsCh, anzCh, srvDep, srvIdxr) - dnsAgent := services.NewDNSAgent(cfg, iFilterSCh, connMgr, srvDep, srvIdxr) - fsAgent := services.NewFreeswitchAgent(cfg, connMgr, srvDep, srvIdxr) - kamAgent := services.NewKamailioAgent(cfg, connMgr, srvDep, srvIdxr) - janusAgent := services.NewJanusAgent(cfg, iFilterSCh, clsCh, connMgr, srvDep, srvIdxr) - astAgent := services.NewAsteriskAgent(cfg, connMgr, srvDep, srvIdxr) - radAgent := services.NewRadiusAgent(cfg, iFilterSCh, connMgr, srvDep, srvIdxr) - diamAgent := services.NewDiameterAgent(cfg, iFilterSCh, connMgr, caps, srvDep, srvIdxr) - httpAgent := services.NewHTTPAgent(cfg, iFilterSCh, clsCh, connMgr, srvDep, srvIdxr) - sipAgent := services.NewSIPAgent(cfg, iFilterSCh, connMgr, srvDep, srvIdxr) - eeS := services.NewEventExporterService(cfg, iFilterSCh, connMgr, clsCh, anzCh, srvDep, srvIdxr) - cdrS := services.NewCDRServer(cfg, dmS, sdbS, iFilterSCh, clsCh, connMgr, anzCh, srvDep, srvIdxr) - registrarcS := services.NewRegistrarCService(cfg, connMgr, srvDep, srvIdxr) - rateS := services.NewRateService(cfg, cacheS, iFilterSCh, dmS, clsCh, anzCh, srvDep, srvIdxr) - actionS := services.NewActionService(cfg, dmS, cacheS, iFilterSCh, connMgr, clsCh, anzCh, srvDep, srvIdxr) - accS := services.NewAccountService(cfg, dmS, cacheS, iFilterSCh, connMgr, clsCh, anzCh, srvDep, srvIdxr) - tpeS := services.NewTPeService(cfg, connMgr, dmS, clsCh, srvDep, srvIdxr) + erS := services.NewEventReaderService(cfg, iFilterSCh, connMgr, clsCh, anzCh, srvIdxr) + dnsAgent := services.NewDNSAgent(cfg, iFilterSCh, connMgr, srvIdxr) + fsAgent := services.NewFreeswitchAgent(cfg, connMgr, srvIdxr) + kamAgent := services.NewKamailioAgent(cfg, connMgr, srvIdxr) + janusAgent := services.NewJanusAgent(cfg, iFilterSCh, clsCh, connMgr, srvIdxr) + astAgent := services.NewAsteriskAgent(cfg, connMgr, srvIdxr) + radAgent := services.NewRadiusAgent(cfg, iFilterSCh, connMgr, srvIdxr) + diamAgent := services.NewDiameterAgent(cfg, iFilterSCh, connMgr, caps, srvIdxr) + httpAgent := services.NewHTTPAgent(cfg, iFilterSCh, clsCh, connMgr, srvIdxr) + sipAgent := services.NewSIPAgent(cfg, iFilterSCh, connMgr, srvIdxr) + eeS := services.NewEventExporterService(cfg, iFilterSCh, connMgr, clsCh, anzCh, srvIdxr) + cdrS := services.NewCDRServer(cfg, dmS, sdbS, iFilterSCh, clsCh, connMgr, anzCh, srvIdxr) + registrarcS := services.NewRegistrarCService(cfg, connMgr, srvIdxr) + rateS := services.NewRateService(cfg, cacheS, iFilterSCh, dmS, clsCh, anzCh, srvIdxr) + actionS := services.NewActionService(cfg, dmS, cacheS, iFilterSCh, connMgr, clsCh, anzCh, srvIdxr) + accS := services.NewAccountService(cfg, dmS, cacheS, iFilterSCh, connMgr, clsCh, anzCh, srvIdxr) + tpeS := services.NewTPeService(cfg, connMgr, dmS, clsCh, srvIdxr) srvManager := servmanager.NewServiceManager(shdWg, connMgr, cfg, srvIdxr, []servmanager.Service{ gvS, diff --git a/services/accounts.go b/services/accounts.go index 0bc124810..2437bdc6f 100644 --- a/services/accounts.go +++ b/services/accounts.go @@ -38,7 +38,7 @@ import ( func NewAccountService(cfg *config.CGRConfig, dm *DataDBService, cacheS *CacheService, filterSChan chan *engine.FilterS, connMgr *engine.ConnManager, clSChan chan *commonlisteners.CommonListenerS, - anzChan chan *AnalyzerService, srvDep map[string]*sync.WaitGroup, + anzChan chan *AnalyzerService, srvIndexer *servmanager.ServiceIndexer) servmanager.Service { return &AccountService{ cfg: cfg, @@ -48,7 +48,6 @@ func NewAccountService(cfg *config.CGRConfig, dm *DataDBService, connMgr: connMgr, clSChan: clSChan, anzChan: anzChan, - srvDep: srvDep, rldChan: make(chan struct{}, 1), srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), @@ -72,7 +71,6 @@ type AccountService struct { stopChan chan struct{} connMgr *engine.ConnManager cfg *config.CGRConfig - srvDep map[string]*sync.WaitGroup intRPCconn birpc.ClientConnector // expose API methods over internal connection srvIndexer *servmanager.ServiceIndexer // access directly services from here diff --git a/services/actions.go b/services/actions.go index 123a567f7..3a50d71f9 100644 --- a/services/actions.go +++ b/services/actions.go @@ -39,7 +39,7 @@ func NewActionService(cfg *config.CGRConfig, dm *DataDBService, cacheS *CacheService, filterSChan chan *engine.FilterS, connMgr *engine.ConnManager, clSChan chan *commonlisteners.CommonListenerS, - anzChan chan *AnalyzerService, srvDep map[string]*sync.WaitGroup, + anzChan chan *AnalyzerService, srvIndexer *servmanager.ServiceIndexer) servmanager.Service { return &ActionService{ connMgr: connMgr, @@ -49,7 +49,6 @@ func NewActionService(cfg *config.CGRConfig, dm *DataDBService, filterSChan: filterSChan, clSChan: clSChan, anzChan: anzChan, - srvDep: srvDep, rldChan: make(chan struct{}, 1), srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), @@ -74,7 +73,6 @@ type ActionService struct { connMgr *engine.ConnManager cfg *config.CGRConfig - srvDep map[string]*sync.WaitGroup intRPCconn birpc.ClientConnector // share the API object implementing API calls for internal srvIndexer *servmanager.ServiceIndexer // access directly services from here diff --git a/services/adminsv1.go b/services/adminsv1.go index d5b49b7e2..d05bee1bd 100644 --- a/services/adminsv1.go +++ b/services/adminsv1.go @@ -36,7 +36,6 @@ func NewAdminSv1Service(cfg *config.CGRConfig, dm *DataDBService, storDB *StorDBService, filterSChan chan *engine.FilterS, clSChan chan *commonlisteners.CommonListenerS, connMgr *engine.ConnManager, anzChan chan *AnalyzerService, - srvDep map[string]*sync.WaitGroup, srvIndexer *servmanager.ServiceIndexer) servmanager.Service { return &AdminSv1Service{ cfg: cfg, @@ -46,7 +45,6 @@ func NewAdminSv1Service(cfg *config.CGRConfig, clSChan: clSChan, connMgr: connMgr, anzChan: anzChan, - srvDep: srvDep, srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), } @@ -68,7 +66,6 @@ type AdminSv1Service struct { stopChan chan struct{} connMgr *engine.ConnManager cfg *config.CGRConfig - srvDep map[string]*sync.WaitGroup intRPCconn birpc.ClientConnector // RPC connector with internal APIs srvIndexer *servmanager.ServiceIndexer // access directly services from here diff --git a/services/analyzers.go b/services/analyzers.go index a17f17e2b..802a5f300 100644 --- a/services/analyzers.go +++ b/services/analyzers.go @@ -36,14 +36,12 @@ import ( func NewAnalyzerService(cfg *config.CGRConfig, clSChan chan *commonlisteners.CommonListenerS, filterSChan chan *engine.FilterS, anzChan chan *AnalyzerService, - srvDep map[string]*sync.WaitGroup, srvIndexer *servmanager.ServiceIndexer) *AnalyzerService { return &AnalyzerService{ cfg: cfg, clSChan: clSChan, filterSChan: filterSChan, anzChan: anzChan, - srvDep: srvDep, srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), } @@ -62,7 +60,6 @@ type AnalyzerService struct { cancelFunc context.CancelFunc cfg *config.CGRConfig - srvDep map[string]*sync.WaitGroup intRPCconn birpc.ClientConnector // share the API object implementing API calls for internal srvIndexer *servmanager.ServiceIndexer // access directly services from here diff --git a/services/asteriskagent.go b/services/asteriskagent.go index 5b179bbe0..e233f66b9 100644 --- a/services/asteriskagent.go +++ b/services/asteriskagent.go @@ -35,12 +35,10 @@ import ( // NewAsteriskAgent returns the Asterisk Agent func NewAsteriskAgent(cfg *config.CGRConfig, connMgr *engine.ConnManager, - srvDep map[string]*sync.WaitGroup, srvIndexer *servmanager.ServiceIndexer) servmanager.Service { return &AsteriskAgent{ cfg: cfg, connMgr: connMgr, - srvDep: srvDep, srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), } @@ -54,7 +52,6 @@ type AsteriskAgent struct { smas []*agents.AsteriskAgent connMgr *engine.ConnManager - srvDep map[string]*sync.WaitGroup intRPCconn birpc.ClientConnector // share the API object implementing API calls for internal srvIndexer *servmanager.ServiceIndexer // access directly services from here diff --git a/services/attributes.go b/services/attributes.go index 0803a197c..c05790972 100644 --- a/services/attributes.go +++ b/services/attributes.go @@ -37,7 +37,7 @@ func NewAttributeService(cfg *config.CGRConfig, dm *DataDBService, cacheS *CacheService, filterSChan chan *engine.FilterS, clSChan chan *commonlisteners.CommonListenerS, anzChan chan *AnalyzerService, dspS *DispatcherService, - srvDep map[string]*sync.WaitGroup, sIndxr *servmanager.ServiceIndexer) servmanager.Service { + sIndxr *servmanager.ServiceIndexer) servmanager.Service { return &AttributeService{ cfg: cfg, dm: dm, @@ -45,7 +45,6 @@ func NewAttributeService(cfg *config.CGRConfig, dm *DataDBService, filterSChan: filterSChan, clSChan: clSChan, anzChan: anzChan, - srvDep: srvDep, dspS: dspS, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), serviceIndexer: sIndxr, @@ -67,8 +66,7 @@ type AttributeService struct { cl *commonlisteners.CommonListenerS rpc *apis.AttributeSv1 // useful on restart - cfg *config.CGRConfig - srvDep map[string]*sync.WaitGroup + cfg *config.CGRConfig intRPCconn birpc.ClientConnector // expose API methods over internal connection serviceIndexer *servmanager.ServiceIndexer // access directly services from here diff --git a/services/caches.go b/services/caches.go index 04247bb51..85190fd05 100644 --- a/services/caches.go +++ b/services/caches.go @@ -19,8 +19,6 @@ along with this program. If not, see package services import ( - "sync" - "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" "github.com/cgrates/cgrates/commonlisteners" @@ -36,11 +34,9 @@ func NewCacheService(cfg *config.CGRConfig, dm *DataDBService, connMgr *engine.C clSChan chan *commonlisteners.CommonListenerS, anzChan chan *AnalyzerService, // dspS *DispatcherService, cores *CoreService, - srvDep map[string]*sync.WaitGroup, srvIndexer *servmanager.ServiceIndexer) *CacheService { return &CacheService{ cfg: cfg, - srvDep: srvDep, anzChan: anzChan, cores: cores, clSChan: clSChan, @@ -64,7 +60,6 @@ type CacheService struct { cacheCh chan *engine.CacheS connMgr *engine.ConnManager cfg *config.CGRConfig - srvDep map[string]*sync.WaitGroup intRPCconn birpc.ClientConnector // expose API methods over internal connection srvIndexer *servmanager.ServiceIndexer // access directly services from here diff --git a/services/cdrs.go b/services/cdrs.go index 635446689..194e70aa2 100644 --- a/services/cdrs.go +++ b/services/cdrs.go @@ -38,7 +38,6 @@ func NewCDRServer(cfg *config.CGRConfig, dm *DataDBService, storDB *StorDBService, filterSChan chan *engine.FilterS, clSChan chan *commonlisteners.CommonListenerS, connMgr *engine.ConnManager, anzChan chan *AnalyzerService, - srvDep map[string]*sync.WaitGroup, srvIndexer *servmanager.ServiceIndexer) servmanager.Service { return &CDRService{ cfg: cfg, @@ -48,7 +47,6 @@ func NewCDRServer(cfg *config.CGRConfig, dm *DataDBService, clSChan: clSChan, connMgr: connMgr, anzChan: anzChan, - srvDep: srvDep, srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), } @@ -70,7 +68,6 @@ type CDRService struct { stopChan chan struct{} connMgr *engine.ConnManager cfg *config.CGRConfig - srvDep map[string]*sync.WaitGroup intRPCconn birpc.ClientConnector // expose API methods over internal connection srvIndexer *servmanager.ServiceIndexer // access directly services from here diff --git a/services/chargers.go b/services/chargers.go index 4c01429a2..d12318514 100644 --- a/services/chargers.go +++ b/services/chargers.go @@ -36,7 +36,7 @@ import ( func NewChargerService(cfg *config.CGRConfig, dm *DataDBService, cacheS *CacheService, filterSChan chan *engine.FilterS, clSChan chan *commonlisteners.CommonListenerS, connMgr *engine.ConnManager, - anzChan chan *AnalyzerService, srvDep map[string]*sync.WaitGroup, + anzChan chan *AnalyzerService, srvIndexer *servmanager.ServiceIndexer) servmanager.Service { return &ChargerService{ cfg: cfg, @@ -46,7 +46,6 @@ func NewChargerService(cfg *config.CGRConfig, dm *DataDBService, clSChan: clSChan, connMgr: connMgr, anzChan: anzChan, - srvDep: srvDep, srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), } @@ -67,7 +66,6 @@ type ChargerService struct { connMgr *engine.ConnManager cfg *config.CGRConfig - srvDep map[string]*sync.WaitGroup intRPCconn birpc.ClientConnector // expose API methods over internal connection srvIndexer *servmanager.ServiceIndexer // access directly services from here diff --git a/services/commonlisteners.go b/services/commonlisteners.go index c18405f41..1b0802164 100644 --- a/services/commonlisteners.go +++ b/services/commonlisteners.go @@ -33,13 +33,12 @@ import ( // NewCommonListenerService instantiates a new CommonListenerService. func NewCommonListenerService(cfg *config.CGRConfig, caps *engine.Caps, - clSChan chan *commonlisteners.CommonListenerS, srvDep map[string]*sync.WaitGroup, + clSChan chan *commonlisteners.CommonListenerS, srvIndexer *servmanager.ServiceIndexer) *CommonListenerService { return &CommonListenerService{ cfg: cfg, caps: caps, clSChan: clSChan, - srvDep: srvDep, srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), } @@ -54,7 +53,6 @@ type CommonListenerService struct { clSChan chan *commonlisteners.CommonListenerS caps *engine.Caps cfg *config.CGRConfig - srvDep map[string]*sync.WaitGroup intRPCconn birpc.ClientConnector // expose API methods over internal connection srvIndexer *servmanager.ServiceIndexer // access directly services from here diff --git a/services/cores.go b/services/cores.go index 1a42c47f8..fc953deb8 100644 --- a/services/cores.go +++ b/services/cores.go @@ -37,7 +37,6 @@ import ( func NewCoreService(cfg *config.CGRConfig, caps *engine.Caps, clSChan chan *commonlisteners.CommonListenerS, anzChan chan *AnalyzerService, fileCPU *os.File, shdWg *sync.WaitGroup, - srvDep map[string]*sync.WaitGroup, srvIndexer *servmanager.ServiceIndexer) *CoreService { return &CoreService{ shdWg: shdWg, @@ -46,7 +45,6 @@ func NewCoreService(cfg *config.CGRConfig, caps *engine.Caps, clSChan chan *comm fileCPU: fileCPU, clSChan: clSChan, anzChan: anzChan, - srvDep: srvDep, csCh: make(chan *cores.CoreS, 1), srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), @@ -69,7 +67,6 @@ type CoreService struct { stopChan chan struct{} shdWg *sync.WaitGroup cfg *config.CGRConfig - srvDep map[string]*sync.WaitGroup intRPCconn birpc.ClientConnector // expose API methods over internal connection srvIndexer *servmanager.ServiceIndexer // access directly services from here diff --git a/services/diameteragent.go b/services/diameteragent.go index 2d48bcf90..e4dde1d19 100644 --- a/services/diameteragent.go +++ b/services/diameteragent.go @@ -34,14 +34,12 @@ import ( // NewDiameterAgent returns the Diameter Agent func NewDiameterAgent(cfg *config.CGRConfig, filterSChan chan *engine.FilterS, connMgr *engine.ConnManager, caps *engine.Caps, - srvDep map[string]*sync.WaitGroup, srvIndexer *servmanager.ServiceIndexer) servmanager.Service { return &DiameterAgent{ cfg: cfg, filterSChan: filterSChan, connMgr: connMgr, caps: caps, - srvDep: srvDep, srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), } @@ -61,8 +59,6 @@ type DiameterAgent struct { lnet string laddr string - srvDep map[string]*sync.WaitGroup - intRPCconn birpc.ClientConnector // expose API methods over internal connection srvIndexer *servmanager.ServiceIndexer // access directly services from here stateDeps *StateDependencies // channel subscriptions for state changes diff --git a/services/dispatchers.go b/services/dispatchers.go index 6ec37d9d1..1eee9d444 100644 --- a/services/dispatchers.go +++ b/services/dispatchers.go @@ -36,7 +36,6 @@ func NewDispatcherService(cfg *config.CGRConfig, dm *DataDBService, cacheS *CacheService, filterSChan chan *engine.FilterS, clSChan chan *commonlisteners.CommonListenerS, connMgr *engine.ConnManager, anzChan chan *AnalyzerService, - srvDep map[string]*sync.WaitGroup, srvIndexer *servmanager.ServiceIndexer) *DispatcherService { return &DispatcherService{ cfg: cfg, @@ -46,7 +45,6 @@ func NewDispatcherService(cfg *config.CGRConfig, dm *DataDBService, clSChan: clSChan, connMgr: connMgr, anzChan: anzChan, - srvDep: srvDep, srvsReload: make(map[string]chan struct{}), srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), @@ -69,7 +67,6 @@ type DispatcherService struct { connMgr *engine.ConnManager cfg *config.CGRConfig srvsReload map[string]chan struct{} - srvDep map[string]*sync.WaitGroup intRPCconn birpc.ClientConnector // expose API methods over internal connection srvIndexer *servmanager.ServiceIndexer // access directly services from here diff --git a/services/dnsagent.go b/services/dnsagent.go index ab199dd4f..f9f112b2d 100644 --- a/services/dnsagent.go +++ b/services/dnsagent.go @@ -34,13 +34,11 @@ import ( // NewDNSAgent returns the DNS Agent func NewDNSAgent(cfg *config.CGRConfig, filterSChan chan *engine.FilterS, connMgr *engine.ConnManager, - srvDep map[string]*sync.WaitGroup, srvIndexer *servmanager.ServiceIndexer) servmanager.Service { return &DNSAgent{ cfg: cfg, filterSChan: filterSChan, connMgr: connMgr, - srvDep: srvDep, srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), } @@ -56,7 +54,6 @@ type DNSAgent struct { dns *agents.DNSAgent connMgr *engine.ConnManager - srvDep map[string]*sync.WaitGroup intRPCconn birpc.ClientConnector // expose API methods over internal connection srvIndexer *servmanager.ServiceIndexer // access directly services from here diff --git a/services/ees.go b/services/ees.go index f7ba8e7f7..881c9291a 100644 --- a/services/ees.go +++ b/services/ees.go @@ -35,7 +35,7 @@ import ( // NewEventExporterService constructs EventExporterService func NewEventExporterService(cfg *config.CGRConfig, filterSChan chan *engine.FilterS, connMgr *engine.ConnManager, clSChan chan *commonlisteners.CommonListenerS, - anzChan chan *AnalyzerService, srvDep map[string]*sync.WaitGroup, + anzChan chan *AnalyzerService, srvIndexer *servmanager.ServiceIndexer) servmanager.Service { return &EventExporterService{ cfg: cfg, @@ -43,7 +43,6 @@ func NewEventExporterService(cfg *config.CGRConfig, filterSChan chan *engine.Fil connMgr: connMgr, clSChan: clSChan, anzChan: anzChan, - srvDep: srvDep, srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), } @@ -62,7 +61,6 @@ type EventExporterService struct { connMgr *engine.ConnManager cfg *config.CGRConfig - srvDep map[string]*sync.WaitGroup intRPCconn birpc.ClientConnector // expose API methods over internal connection srvIndexer *servmanager.ServiceIndexer // access directly services from here diff --git a/services/efs.go b/services/efs.go index c8c86b39a..f1abf3312 100644 --- a/services/efs.go +++ b/services/efs.go @@ -46,7 +46,6 @@ type ExportFailoverService struct { stopChan chan struct{} connMgr *engine.ConnManager cfg *config.CGRConfig - srvDep map[string]*sync.WaitGroup intRPCconn birpc.ClientConnector // expose API methods over internal connection srvIndexer *servmanager.ServiceIndexer // access directly services from here @@ -56,13 +55,11 @@ type ExportFailoverService struct { // NewExportFailoverService is the constructor for the TpeService func NewExportFailoverService(cfg *config.CGRConfig, connMgr *engine.ConnManager, clSChan chan *commonlisteners.CommonListenerS, - srvDep map[string]*sync.WaitGroup, srvIndexer *servmanager.ServiceIndexer) *ExportFailoverService { return &ExportFailoverService{ cfg: cfg, clSChan: clSChan, connMgr: connMgr, - srvDep: srvDep, srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), } diff --git a/services/ers.go b/services/ers.go index 2427fce0e..8618cce9d 100644 --- a/services/ers.go +++ b/services/ers.go @@ -39,7 +39,6 @@ func NewEventReaderService( connMgr *engine.ConnManager, clSChan chan *commonlisteners.CommonListenerS, anzChan chan *AnalyzerService, - srvDep map[string]*sync.WaitGroup, srvIndexer *servmanager.ServiceIndexer) servmanager.Service { return &EventReaderService{ rldChan: make(chan struct{}, 1), @@ -48,7 +47,6 @@ func NewEventReaderService( connMgr: connMgr, clSChan: clSChan, anzChan: anzChan, - srvDep: srvDep, srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), } @@ -69,7 +67,6 @@ type EventReaderService struct { stopChan chan struct{} connMgr *engine.ConnManager cfg *config.CGRConfig - srvDep map[string]*sync.WaitGroup intRPCconn birpc.ClientConnector // expose API methods over internal connection srvIndexer *servmanager.ServiceIndexer // access directly services from here diff --git a/services/freeswitchagent.go b/services/freeswitchagent.go index 4b5aebeb9..847607e5f 100644 --- a/services/freeswitchagent.go +++ b/services/freeswitchagent.go @@ -35,12 +35,10 @@ import ( // NewFreeswitchAgent returns the Freeswitch Agent func NewFreeswitchAgent(cfg *config.CGRConfig, connMgr *engine.ConnManager, - srvDep map[string]*sync.WaitGroup, srvIndexer *servmanager.ServiceIndexer) servmanager.Service { return &FreeswitchAgent{ cfg: cfg, connMgr: connMgr, - srvDep: srvDep, srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), } @@ -53,7 +51,6 @@ type FreeswitchAgent struct { fS *agents.FSsessions connMgr *engine.ConnManager - srvDep map[string]*sync.WaitGroup intRPCconn birpc.ClientConnector // expose API methods over internal connection srvIndexer *servmanager.ServiceIndexer // access directly services from here diff --git a/services/globalvars.go b/services/globalvars.go index b1c0d8c69..f980bdab8 100644 --- a/services/globalvars.go +++ b/services/globalvars.go @@ -19,8 +19,6 @@ along with this program. If not, see package services import ( - "sync" - "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" "github.com/cgrates/cgrates/engine" @@ -32,11 +30,9 @@ import ( // NewGlobalVarS . func NewGlobalVarS(cfg *config.CGRConfig, - srvDep map[string]*sync.WaitGroup, srvIndexer *servmanager.ServiceIndexer) *GlobalVarS { return &GlobalVarS{ cfg: cfg, - srvDep: srvDep, srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), } @@ -44,8 +40,7 @@ func NewGlobalVarS(cfg *config.CGRConfig, // GlobalVarS implements Agent interface type GlobalVarS struct { - cfg *config.CGRConfig - srvDep map[string]*sync.WaitGroup + cfg *config.CGRConfig intRPCconn birpc.ClientConnector // expose API methods over internal connection srvIndexer *servmanager.ServiceIndexer // access directly services from here diff --git a/services/httpagent.go b/services/httpagent.go index facc50e1d..cbd12a0ad 100644 --- a/services/httpagent.go +++ b/services/httpagent.go @@ -35,14 +35,12 @@ import ( // NewHTTPAgent returns the HTTP Agent func NewHTTPAgent(cfg *config.CGRConfig, filterSChan chan *engine.FilterS, clSChan chan *commonlisteners.CommonListenerS, connMgr *engine.ConnManager, - srvDep map[string]*sync.WaitGroup, srvIndexer *servmanager.ServiceIndexer) servmanager.Service { return &HTTPAgent{ cfg: cfg, filterSChan: filterSChan, clSChan: clSChan, connMgr: connMgr, - srvDep: srvDep, srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), } @@ -63,7 +61,6 @@ type HTTPAgent struct { connMgr *engine.ConnManager cfg *config.CGRConfig - srvDep map[string]*sync.WaitGroup intRPCconn birpc.ClientConnector // expose API methods over internal connection srvIndexer *servmanager.ServiceIndexer // access directly services from here diff --git a/services/janus.go b/services/janus.go index 0ed20d203..f2248f302 100644 --- a/services/janus.go +++ b/services/janus.go @@ -36,14 +36,12 @@ import ( // NewJanusAgent returns the Janus Agent func NewJanusAgent(cfg *config.CGRConfig, filterSChan chan *engine.FilterS, clSChan chan *commonlisteners.CommonListenerS, connMgr *engine.ConnManager, - srvDep map[string]*sync.WaitGroup, srvIndexer *servmanager.ServiceIndexer) servmanager.Service { return &JanusAgent{ cfg: cfg, filterSChan: filterSChan, clSChan: clSChan, connMgr: connMgr, - srvDep: srvDep, srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), } @@ -64,7 +62,6 @@ type JanusAgent struct { connMgr *engine.ConnManager cfg *config.CGRConfig - srvDep map[string]*sync.WaitGroup intRPCconn birpc.ClientConnector // expose API methods over internal connection srvIndexer *servmanager.ServiceIndexer // access directly services from here diff --git a/services/kamailioagent.go b/services/kamailioagent.go index 0a912cace..5b9faa606 100644 --- a/services/kamailioagent.go +++ b/services/kamailioagent.go @@ -36,12 +36,10 @@ import ( // NewKamailioAgent returns the Kamailio Agent func NewKamailioAgent(cfg *config.CGRConfig, connMgr *engine.ConnManager, - srvDep map[string]*sync.WaitGroup, srvIndexer *servmanager.ServiceIndexer) servmanager.Service { return &KamailioAgent{ cfg: cfg, connMgr: connMgr, - srvDep: srvDep, srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), } @@ -54,7 +52,6 @@ type KamailioAgent struct { kam *agents.KamailioAgent connMgr *engine.ConnManager - srvDep map[string]*sync.WaitGroup intRPCconn birpc.ClientConnector // expose API methods over internal connection srvIndexer *servmanager.ServiceIndexer // access directly services from here diff --git a/services/loaders.go b/services/loaders.go index 30fe0073b..b9022b565 100644 --- a/services/loaders.go +++ b/services/loaders.go @@ -36,7 +36,6 @@ import ( func NewLoaderService(cfg *config.CGRConfig, dm *DataDBService, filterSChan chan *engine.FilterS, clSChan chan *commonlisteners.CommonListenerS, connMgr *engine.ConnManager, anzChan chan *AnalyzerService, - srvDep map[string]*sync.WaitGroup, srvIndexer *servmanager.ServiceIndexer) *LoaderService { return &LoaderService{ cfg: cfg, @@ -46,7 +45,6 @@ func NewLoaderService(cfg *config.CGRConfig, dm *DataDBService, connMgr: connMgr, stopChan: make(chan struct{}), anzChan: anzChan, - srvDep: srvDep, srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), } @@ -67,7 +65,6 @@ type LoaderService struct { stopChan chan struct{} connMgr *engine.ConnManager cfg *config.CGRConfig - srvDep map[string]*sync.WaitGroup intRPCconn birpc.ClientConnector // expose API methods over internal connection srvIndexer *servmanager.ServiceIndexer // access directly services from here diff --git a/services/radiusagent.go b/services/radiusagent.go index b231ddcbc..a466a6dff 100644 --- a/services/radiusagent.go +++ b/services/radiusagent.go @@ -34,13 +34,11 @@ import ( // NewRadiusAgent returns the Radius Agent func NewRadiusAgent(cfg *config.CGRConfig, filterSChan chan *engine.FilterS, connMgr *engine.ConnManager, - srvDep map[string]*sync.WaitGroup, srvIndexer *servmanager.ServiceIndexer) servmanager.Service { return &RadiusAgent{ cfg: cfg, filterSChan: filterSChan, connMgr: connMgr, - srvDep: srvDep, srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), } @@ -55,7 +53,6 @@ type RadiusAgent struct { rad *agents.RadiusAgent connMgr *engine.ConnManager - srvDep map[string]*sync.WaitGroup lnet string lauth string diff --git a/services/rates.go b/services/rates.go index 25d7562b8..890751ffd 100644 --- a/services/rates.go +++ b/services/rates.go @@ -36,7 +36,6 @@ func NewRateService(cfg *config.CGRConfig, cacheS *CacheService, filterSChan chan *engine.FilterS, dmS *DataDBService, clSChan chan *commonlisteners.CommonListenerS, anzChan chan *AnalyzerService, - srvDep map[string]*sync.WaitGroup, srvIndexer *servmanager.ServiceIndexer) servmanager.Service { return &RateService{ cfg: cfg, @@ -46,7 +45,6 @@ func NewRateService(cfg *config.CGRConfig, clSChan: clSChan, rldChan: make(chan struct{}), anzChan: anzChan, - srvDep: srvDep, srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), } @@ -68,7 +66,6 @@ type RateService struct { rldChan chan struct{} stopChan chan struct{} cfg *config.CGRConfig - srvDep map[string]*sync.WaitGroup intRPCconn birpc.ClientConnector // expose API methods over internal connection srvIndexer *servmanager.ServiceIndexer // access directly services from here diff --git a/services/registrarc.go b/services/registrarc.go index b3860b049..4ad2d4f0c 100644 --- a/services/registrarc.go +++ b/services/registrarc.go @@ -32,12 +32,10 @@ import ( // NewRegistrarCService returns the Dispatcher Service func NewRegistrarCService(cfg *config.CGRConfig, connMgr *engine.ConnManager, - srvDep map[string]*sync.WaitGroup, srvIndexer *servmanager.ServiceIndexer) servmanager.Service { return &RegistrarCService{ cfg: cfg, connMgr: connMgr, - srvDep: srvDep, srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), } @@ -53,7 +51,6 @@ type RegistrarCService struct { rldChan chan struct{} connMgr *engine.ConnManager cfg *config.CGRConfig - srvDep map[string]*sync.WaitGroup intRPCconn birpc.ClientConnector // expose API methods over internal connection srvIndexer *servmanager.ServiceIndexer // access directly services from here diff --git a/services/routes.go b/services/routes.go index 6a8295160..7031e69c3 100644 --- a/services/routes.go +++ b/services/routes.go @@ -37,7 +37,6 @@ func NewRouteService(cfg *config.CGRConfig, dm *DataDBService, cacheS *CacheService, filterSChan chan *engine.FilterS, clSChan chan *commonlisteners.CommonListenerS, connMgr *engine.ConnManager, anzChan chan *AnalyzerService, - srvDep map[string]*sync.WaitGroup, srvIndexer *servmanager.ServiceIndexer) servmanager.Service { return &RouteService{ cfg: cfg, @@ -47,7 +46,6 @@ func NewRouteService(cfg *config.CGRConfig, dm *DataDBService, clSChan: clSChan, connMgr: connMgr, anzChan: anzChan, - srvDep: srvDep, srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), } @@ -68,7 +66,6 @@ type RouteService struct { connMgr *engine.ConnManager cfg *config.CGRConfig - srvDep map[string]*sync.WaitGroup intRPCconn birpc.ClientConnector // expose API methods over internal connection srvIndexer *servmanager.ServiceIndexer // access directly services from here diff --git a/services/sessions.go b/services/sessions.go index 86163fa0f..008235796 100644 --- a/services/sessions.go +++ b/services/sessions.go @@ -38,7 +38,6 @@ import ( func NewSessionService(cfg *config.CGRConfig, dm *DataDBService, filterSChan chan *engine.FilterS, clSChan chan *commonlisteners.CommonListenerS, connMgr *engine.ConnManager, anzChan chan *AnalyzerService, - srvDep map[string]*sync.WaitGroup, srvIndexer *servmanager.ServiceIndexer) servmanager.Service { return &SessionService{ cfg: cfg, @@ -47,7 +46,6 @@ func NewSessionService(cfg *config.CGRConfig, dm *DataDBService, filterSChan cha clSChan: clSChan, connMgr: connMgr, anzChan: anzChan, - srvDep: srvDep, srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), } @@ -69,7 +67,6 @@ type SessionService struct { stopChan chan struct{} connMgr *engine.ConnManager cfg *config.CGRConfig - srvDep map[string]*sync.WaitGroup intRPCconn birpc.ClientConnector // expose API methods over internal connection srvIndexer *servmanager.ServiceIndexer // access directly services from here diff --git a/services/sipagent.go b/services/sipagent.go index 83e7ea9bd..214fe8647 100644 --- a/services/sipagent.go +++ b/services/sipagent.go @@ -34,13 +34,11 @@ import ( // NewSIPAgent returns the sip Agent func NewSIPAgent(cfg *config.CGRConfig, filterSChan chan *engine.FilterS, connMgr *engine.ConnManager, - srvDep map[string]*sync.WaitGroup, srvIndexer *servmanager.ServiceIndexer) servmanager.Service { return &SIPAgent{ cfg: cfg, filterSChan: filterSChan, connMgr: connMgr, - srvDep: srvDep, srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), } @@ -54,7 +52,6 @@ type SIPAgent struct { sip *agents.SIPAgent connMgr *engine.ConnManager - srvDep map[string]*sync.WaitGroup oldListen string diff --git a/services/stordb.go b/services/stordb.go index 72f5d1fe7..e807a270b 100644 --- a/services/stordb.go +++ b/services/stordb.go @@ -32,12 +32,10 @@ import ( // NewStorDBService returns the StorDB Service func NewStorDBService(cfg *config.CGRConfig, setVersions bool, - srvDep map[string]*sync.WaitGroup, srvIndexer *servmanager.ServiceIndexer) *StorDBService { return &StorDBService{ cfg: cfg, setVersions: setVersions, - srvDep: srvDep, srvIndexer: srvIndexer, stateDeps: NewStateDependencies([]string{utils.StateServiceUP}), } @@ -53,8 +51,6 @@ type StorDBService struct { syncChans []chan engine.StorDB setVersions bool - srvDep map[string]*sync.WaitGroup - intRPCconn birpc.ClientConnector // expose API methods over internal connection srvIndexer *servmanager.ServiceIndexer // access directly services from here stateDeps *StateDependencies // channel subscriptions for state changes diff --git a/services/tpes.go b/services/tpes.go index b000e074d..ae1fb15ba 100644 --- a/services/tpes.go +++ b/services/tpes.go @@ -34,11 +34,10 @@ import ( // NewTPeService is the constructor for the TpeService func NewTPeService(cfg *config.CGRConfig, connMgr *engine.ConnManager, dm *DataDBService, - clSChan chan *commonlisteners.CommonListenerS, srvDep map[string]*sync.WaitGroup, + clSChan chan *commonlisteners.CommonListenerS, srvIndexer *servmanager.ServiceIndexer) servmanager.Service { return &TPeService{ cfg: cfg, - srvDep: srvDep, dm: dm, connMgr: connMgr, clSChan: clSChan, @@ -61,7 +60,6 @@ type TPeService struct { stopChan chan struct{} connMgr *engine.ConnManager cfg *config.CGRConfig - srvDep map[string]*sync.WaitGroup intRPCconn birpc.ClientConnector // expose API methods over internal connection srvIndexer *servmanager.ServiceIndexer // access directly services from here