From 5bf8f1756c016a9de38b652ea0d33c9fe899b632 Mon Sep 17 00:00:00 2001 From: ionutboangiu Date: Mon, 4 Nov 2024 17:25:15 +0200 Subject: [PATCH] Extract cores.Server into new commonlisteners package Functionality is the same. Server has been renamed to CommonListenerS. --- cmd/cgr-engine/cgr-engine.go | 3 +- {cores => commonlisteners}/basic_auth.go | 2 +- {cores => commonlisteners}/basic_auth_test.go | 2 +- {cores => commonlisteners}/caps.go | 2 +- {cores => commonlisteners}/caps_test.go | 2 +- .../commonlistener_it_test.go | 4 +- .../commonlisteners.go | 48 +++++++++---------- .../commonlisteners_test.go | 4 +- .../libcommonlisteners.go | 2 +- services/accounts.go | 6 +-- services/accounts_it_test.go | 4 +- services/accounts_test.go | 4 +- services/actions.go | 6 +-- services/actions_it_test.go | 4 +- services/actions_test.go | 4 +- services/adminsv1.go | 6 +-- services/analyzers.go | 6 +-- services/analyzers_it_test.go | 8 ++-- services/analyzers_test.go | 4 +- services/asteriskagent_it_test.go | 6 +-- services/attributes.go | 6 +-- services/attributes_it_test.go | 4 +- services/attributes_test.go | 4 +- services/caches.go | 5 +- services/cdrs.go | 6 +-- services/cdrs_it_test.go | 4 +- services/cdrs_test.go | 4 +- services/cgr-engine.go | 5 +- services/chargers.go | 6 +-- services/chargers_it_test.go | 4 +- services/chargers_test.go | 4 +- services/cores.go | 5 +- services/cores_it_test.go | 4 +- services/cores_test.go | 3 +- services/datadb_it_test.go | 4 +- services/diameteragent_it_test.go | 4 +- services/dispatchers.go | 6 +-- services/dispatchers_it_test.go | 4 +- services/dispatchers_test.go | 4 +- services/dnsagent_it_test.go | 6 +-- services/ees.go | 6 +-- services/ees_it_test.go | 6 +-- services/ees_test.go | 4 +- services/efs.go | 6 +-- services/ers.go | 6 +-- services/ers_it_test.go | 6 +-- services/ers_test.go | 4 +- services/freeswitchagent_it_test.go | 4 +- services/httpagent.go | 6 +-- services/httpagent_it_test.go | 4 +- services/httpagent_test.go | 4 +- services/janus.go | 6 +-- services/kamailioagent_it_test.go | 4 +- services/libcgr-engine.go | 10 ++-- services/loaders.go | 6 +-- services/loaders_it_test.go | 8 ++-- services/loaders_test.go | 4 +- services/radiusagent_it_test.go | 6 +-- services/rankings.go | 6 +-- services/rankings_test.go | 4 +- services/rates.go | 6 +-- services/rates_it_test.go | 4 +- services/rates_test.go | 4 +- services/registrarc.go | 6 +-- services/registrarc_it_test.go | 4 +- services/registrarc_test.go | 4 +- services/resources.go | 6 +-- services/resources_it_test.go | 4 +- services/resources_test.go | 4 +- services/routes.go | 6 +-- services/routes_it_test.go | 4 +- services/routes_test.go | 4 +- services/sessions.go | 6 +-- services/sessions_it_test.go | 8 ++-- services/sessions_test.go | 4 +- services/sipagent_it_test.go | 4 +- services/stats.go | 6 +-- services/stats_it_test.go | 4 +- services/stats_test.go | 4 +- services/thresholds.go | 6 +-- services/thresholds_it_test.go | 6 +-- services/thresholds_test.go | 4 +- services/tpes.go | 6 +-- services/trends.go | 6 +-- services/trends_test.go | 4 +- 85 files changed, 229 insertions(+), 224 deletions(-) rename {cores => commonlisteners}/basic_auth.go (99%) rename {cores => commonlisteners}/basic_auth_test.go (99%) rename {cores => commonlisteners}/caps.go (99%) rename {cores => commonlisteners}/caps_test.go (99%) rename cores/server_it_test.go => commonlisteners/commonlistener_it_test.go (99%) rename cores/server.go => commonlisteners/commonlisteners.go (88%) rename cores/server_test.go => commonlisteners/commonlisteners_test.go (97%) rename cores/libserver.go => commonlisteners/libcommonlisteners.go (99%) diff --git a/cmd/cgr-engine/cgr-engine.go b/cmd/cgr-engine/cgr-engine.go index e7542a59e..ecd7fefe3 100644 --- a/cmd/cgr-engine/cgr-engine.go +++ b/cmd/cgr-engine/cgr-engine.go @@ -26,6 +26,7 @@ import ( "sync" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" @@ -60,7 +61,7 @@ func RunCGREngine(fs []string) (err error) { return } cps := engine.NewCaps(cfg.CoreSCfg().Caps, cfg.CoreSCfg().CapsStrategy) - server := cores.NewServer(cps) + server := commonlisteners.NewServer(cps) cgr := services.NewCGREngine(cfg, engine.NewConnManager(cfg), new(sync.WaitGroup), server, cps) defer cgr.Stop(*flags.PidFile) diff --git a/cores/basic_auth.go b/commonlisteners/basic_auth.go similarity index 99% rename from cores/basic_auth.go rename to commonlisteners/basic_auth.go index 31bf342aa..9b22e189a 100644 --- a/cores/basic_auth.go +++ b/commonlisteners/basic_auth.go @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see */ -package cores +package commonlisteners import ( "encoding/base64" diff --git a/cores/basic_auth_test.go b/commonlisteners/basic_auth_test.go similarity index 99% rename from cores/basic_auth_test.go rename to commonlisteners/basic_auth_test.go index 415e90302..5f6331949 100644 --- a/cores/basic_auth_test.go +++ b/commonlisteners/basic_auth_test.go @@ -15,7 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see */ -package cores +package commonlisteners import ( "encoding/base64" diff --git a/cores/caps.go b/commonlisteners/caps.go similarity index 99% rename from cores/caps.go rename to commonlisteners/caps.go index 16c6b8e0e..e9915a874 100644 --- a/cores/caps.go +++ b/commonlisteners/caps.go @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see */ -package cores +package commonlisteners import ( "net" diff --git a/cores/caps_test.go b/commonlisteners/caps_test.go similarity index 99% rename from cores/caps_test.go rename to commonlisteners/caps_test.go index 51cad9971..5e8f876e4 100644 --- a/cores/caps_test.go +++ b/commonlisteners/caps_test.go @@ -15,7 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see */ -package cores +package commonlisteners import ( "net" diff --git a/cores/server_it_test.go b/commonlisteners/commonlistener_it_test.go similarity index 99% rename from cores/server_it_test.go rename to commonlisteners/commonlistener_it_test.go index 8155dcc29..9283d020a 100644 --- a/cores/server_it_test.go +++ b/commonlisteners/commonlistener_it_test.go @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see */ -package cores +package commonlisteners import ( "bytes" @@ -48,7 +48,7 @@ import ( ) var ( - server *Server + server *CommonListenerS sTestsServer = []func(t *testing.T){ testServeJSON, diff --git a/cores/server.go b/commonlisteners/commonlisteners.go similarity index 88% rename from cores/server.go rename to commonlisteners/commonlisteners.go index f5822a587..80f03af1f 100644 --- a/cores/server.go +++ b/commonlisteners/commonlisteners.go @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see */ -package cores +package commonlisteners import ( "crypto/tls" @@ -39,8 +39,8 @@ import ( "golang.org/x/net/websocket" ) -func NewServer(caps *engine.Caps) (s *Server) { - s = &Server{ +func NewServer(caps *engine.Caps) (s *CommonListenerS) { + s = &CommonListenerS{ httpMux: http.NewServeMux(), httpsMux: http.NewServeMux(), stopbiRPCServer: make(chan struct{}, 1), @@ -54,7 +54,7 @@ func NewServer(caps *engine.Caps) (s *Server) { return } -type Server struct { +type CommonListenerS struct { sync.RWMutex httpEnabled bool birpcSrv *birpc.BirpcServer @@ -74,23 +74,23 @@ type Server struct { startSrv sync.Once } -func (s *Server) SetAnalyzer(anz *analyzers.AnalyzerS) { +func (s *CommonListenerS) SetAnalyzer(anz *analyzers.AnalyzerS) { s.anz = anz } -func (s *Server) RpcRegister(rcvr any) { +func (s *CommonListenerS) RpcRegister(rcvr any) { s.rpcServer.Register(rcvr) } -func (s *Server) RpcRegisterName(name string, rcvr any) { +func (s *CommonListenerS) RpcRegisterName(name string, rcvr any) { s.rpcServer.RegisterName(name, rcvr) } -func (s *Server) RpcUnregisterName(name string) { +func (s *CommonListenerS) RpcUnregisterName(name string) { s.rpcServer.UnregisterName(name) } -func (s *Server) RegisterHTTPFunc(pattern string, handler func(http.ResponseWriter, *http.Request)) { +func (s *CommonListenerS) RegisterHTTPFunc(pattern string, handler func(http.ResponseWriter, *http.Request)) { s.httpMux.HandleFunc(pattern, handler) s.httpsMux.HandleFunc(pattern, handler) s.Lock() @@ -98,7 +98,7 @@ func (s *Server) RegisterHTTPFunc(pattern string, handler func(http.ResponseWrit s.Unlock() } -func (s *Server) RegisterHttpHandler(pattern string, handler http.Handler) { +func (s *CommonListenerS) RegisterHttpHandler(pattern string, handler http.Handler) { s.httpMux.Handle(pattern, handler) s.httpsMux.Handle(pattern, handler) s.Lock() @@ -107,15 +107,15 @@ func (s *Server) RegisterHttpHandler(pattern string, handler http.Handler) { } // Registers a new BiJsonRpc name -func (s *Server) BiRPCRegisterName(name string, rcv any) { +func (s *CommonListenerS) BiRPCRegisterName(name string, rcv any) { s.birpcSrv.RegisterName(name, rcv) } -func (s *Server) BiRPCUnregisterName(name string) { +func (s *CommonListenerS) BiRPCUnregisterName(name string) { s.birpcSrv.UnregisterName(name) } -func (s *Server) handleRequest(w http.ResponseWriter, r *http.Request) { +func (s *CommonListenerS) handleRequest(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") rmtIP, _ := utils.GetRemoteIP(r) rmtAddr, _ := net.ResolveIPAddr(utils.EmptyString, rmtIP) @@ -124,11 +124,11 @@ func (s *Server) handleRequest(w http.ResponseWriter, r *http.Request) { r.Body.Close() } -func (s *Server) handleWebSocket(ws *websocket.Conn) { +func (s *CommonListenerS) handleWebSocket(ws *websocket.Conn) { s.rpcServer.ServeCodec(newCapsJSONCodec(ws, s.caps, s.anz)) } -func (s *Server) ServeJSON(ctx *context.Context, shtdwnEngine context.CancelFunc, addr string) (err error) { +func (s *CommonListenerS) ServeJSON(ctx *context.Context, shtdwnEngine context.CancelFunc, addr string) (err error) { if s.rpcJSONl, err = net.Listen(utils.TCP, addr); err != nil { log.Printf("Serve%s listen error: %s", utils.JSONCaps, err) shtdwnEngine() @@ -140,7 +140,7 @@ func (s *Server) ServeJSON(ctx *context.Context, shtdwnEngine context.CancelFunc }) } -func (s *Server) ServeGOB(ctx *context.Context, shtdwnEngine context.CancelFunc, addr string) (err error) { +func (s *CommonListenerS) ServeGOB(ctx *context.Context, shtdwnEngine context.CancelFunc, addr string) (err error) { if s.rpcGOBl, err = net.Listen(utils.TCP, addr); err != nil { log.Printf("Serve%s listen error: %s", utils.GOBCaps, err) shtdwnEngine() @@ -152,7 +152,7 @@ func (s *Server) ServeGOB(ctx *context.Context, shtdwnEngine context.CancelFunc, }) } -func (s *Server) ServeHTTP(shtdwnEngine context.CancelFunc, +func (s *CommonListenerS) ServeHTTP(shtdwnEngine context.CancelFunc, addr, jsonRPCURL, wsRPCURL, promURL, pprofPath string, useBasicAuth bool, userList map[string]string) { s.Lock() @@ -219,7 +219,7 @@ func (s *Server) ServeHTTP(shtdwnEngine context.CancelFunc, } // ServeBiRPC create a goroutine to listen and serve as BiRPC server -func (s *Server) ServeBiRPC(addrJSON, addrGOB string, onConn, onDis func(birpc.ClientConnector)) (err error) { +func (s *CommonListenerS) ServeBiRPC(addrJSON, addrGOB string, onConn, onDis func(birpc.ClientConnector)) (err error) { s.birpcSrv.OnConnect(onConn) s.birpcSrv.OnDisconnect(onDis) if addrJSON != utils.EmptyString { @@ -244,7 +244,7 @@ func (s *Server) ServeBiRPC(addrJSON, addrGOB string, onConn, onDis func(birpc.C return } -func (s *Server) ServeGOBTLS(ctx *context.Context, shtdwnEngine context.CancelFunc, +func (s *CommonListenerS) ServeGOBTLS(ctx *context.Context, shtdwnEngine context.CancelFunc, addr, serverCrt, serverKey, caCert string, serverPolicy int, serverName string) (err error) { config, err := loadTLSConfig(serverCrt, serverKey, caCert, serverPolicy, serverName) if err != nil { @@ -264,7 +264,7 @@ func (s *Server) ServeGOBTLS(ctx *context.Context, shtdwnEngine context.CancelFu }) } -func (s *Server) ServeJSONTLS(ctx *context.Context, shtdwnEngine context.CancelFunc, +func (s *CommonListenerS) ServeJSONTLS(ctx *context.Context, shtdwnEngine context.CancelFunc, addr, serverCrt, serverKey, caCert string, serverPolicy int, serverName string) (err error) { config, err := loadTLSConfig(serverCrt, serverKey, caCert, serverPolicy, serverName) if err != nil { @@ -284,7 +284,7 @@ func (s *Server) ServeJSONTLS(ctx *context.Context, shtdwnEngine context.CancelF }) } -func (s *Server) ServeHTTPS(shtdwnEngine context.CancelFunc, +func (s *CommonListenerS) ServeHTTPS(shtdwnEngine context.CancelFunc, addr, serverCrt, serverKey, caCert string, serverPolicy int, serverName, jsonRPCURL, wsRPCURL, pprofPath string, useBasicAuth bool, userList map[string]string) { @@ -349,7 +349,7 @@ func (s *Server) ServeHTTPS(shtdwnEngine context.CancelFunc, } } -func (s *Server) Stop() { +func (s *CommonListenerS) Stop() { if s.rpcJSONl != nil { s.rpcJSONl.Close() } @@ -372,12 +372,12 @@ func (s *Server) Stop() { } // StopBiRPC stops the go routine create with ServeBiJSON -func (s *Server) StopBiRPC() { +func (s *CommonListenerS) StopBiRPC() { s.stopbiRPCServer <- struct{}{} s.birpcSrv = birpc.NewBirpcServer() } -func (s *Server) StartServer(ctx *context.Context, shtdwnEngine context.CancelFunc, cfg *config.CGRConfig) { +func (s *CommonListenerS) StartServer(ctx *context.Context, shtdwnEngine context.CancelFunc, cfg *config.CGRConfig) { s.startSrv.Do(func() { go s.ServeJSON(ctx, shtdwnEngine, cfg.ListenCfg().RPCJSONListen) go s.ServeGOB(ctx, shtdwnEngine, cfg.ListenCfg().RPCGOBListen) diff --git a/cores/server_test.go b/commonlisteners/commonlisteners_test.go similarity index 97% rename from cores/server_test.go rename to commonlisteners/commonlisteners_test.go index 6f8716706..5aa735842 100644 --- a/cores/server_test.go +++ b/commonlisteners/commonlisteners_test.go @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see */ -package cores +package commonlisteners import ( "io" @@ -37,7 +37,7 @@ func TestNewServer(t *testing.T) { cfgDflt.CoreSCfg().CapsStatsInterval = 1 caps := engine.NewCaps(0, utils.MetaBusy) - expected := &Server{ + expected := &CommonListenerS{ httpMux: http.NewServeMux(), httpsMux: http.NewServeMux(), caps: caps, diff --git a/cores/libserver.go b/commonlisteners/libcommonlisteners.go similarity index 99% rename from cores/libserver.go rename to commonlisteners/libcommonlisteners.go index a9f503e00..f1d9f6e0d 100644 --- a/cores/libserver.go +++ b/commonlisteners/libcommonlisteners.go @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see */ -package cores +package commonlisteners import ( "bytes" diff --git a/services/accounts.go b/services/accounts.go index c1cfbdd24..011ee4f7a 100644 --- a/services/accounts.go +++ b/services/accounts.go @@ -26,9 +26,9 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/cgrates/accounts" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -37,7 +37,7 @@ import ( // NewAccountService returns the Account Service func NewAccountService(cfg *config.CGRConfig, dm *DataDBService, cacheS *CacheService, filterSChan chan *engine.FilterS, - connMgr *engine.ConnManager, server *cores.Server, + connMgr *engine.ConnManager, server *commonlisteners.CommonListenerS, internalChan chan birpc.ClientConnector, anz *AnalyzerService, srvDep map[string]*sync.WaitGroup) servmanager.Service { return &AccountService{ @@ -62,7 +62,7 @@ type AccountService struct { cacheS *CacheService filterSChan chan *engine.FilterS connMgr *engine.ConnManager - server *cores.Server + server *commonlisteners.CommonListenerS rldChan chan struct{} stopChan chan struct{} diff --git a/services/accounts_it_test.go b/services/accounts_it_test.go index 3104c6def..89544d74f 100644 --- a/services/accounts_it_test.go +++ b/services/accounts_it_test.go @@ -28,8 +28,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -47,7 +47,7 @@ func TestAccountSReload(t *testing.T) { chSCh := make(chan *engine.CacheS, 1) chSCh <- chS css := &CacheService{cacheCh: chSCh} - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) diff --git a/services/accounts_test.go b/services/accounts_test.go index f00384c85..7a4d7aaf4 100644 --- a/services/accounts_test.go +++ b/services/accounts_test.go @@ -25,9 +25,9 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" "github.com/cgrates/cgrates/accounts" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" ) @@ -37,7 +37,7 @@ func TestAccountSCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) actRPC := make(chan birpc.ClientConnector, 1) diff --git a/services/actions.go b/services/actions.go index da291a833..1b5481bde 100644 --- a/services/actions.go +++ b/services/actions.go @@ -26,9 +26,9 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/cgrates/actions" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -38,7 +38,7 @@ import ( func NewActionService(cfg *config.CGRConfig, dm *DataDBService, cacheS *CacheService, filterSChan chan *engine.FilterS, connMgr *engine.ConnManager, - server *cores.Server, internalChan chan birpc.ClientConnector, + server *commonlisteners.CommonListenerS, internalChan chan birpc.ClientConnector, anz *AnalyzerService, srvDep map[string]*sync.WaitGroup) servmanager.Service { return &ActionService{ connChan: internalChan, @@ -62,7 +62,7 @@ type ActionService struct { cacheS *CacheService filterSChan chan *engine.FilterS connMgr *engine.ConnManager - server *cores.Server + server *commonlisteners.CommonListenerS rldChan chan struct{} stopChan chan struct{} diff --git a/services/actions_it_test.go b/services/actions_it_test.go index 1fe62b10b..0944e2cf2 100644 --- a/services/actions_it_test.go +++ b/services/actions_it_test.go @@ -28,8 +28,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -47,7 +47,7 @@ func TestActionSReload(t *testing.T) { chSCh := make(chan *engine.CacheS, 1) chSCh <- chS css := &CacheService{cacheCh: chSCh} - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) diff --git a/services/actions_test.go b/services/actions_test.go index c550102e0..b92f05b95 100644 --- a/services/actions_test.go +++ b/services/actions_test.go @@ -25,8 +25,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" "github.com/cgrates/cgrates/actions" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" ) @@ -36,7 +36,7 @@ func TestActionSCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) actRPC := make(chan birpc.ClientConnector, 1) diff --git a/services/adminsv1.go b/services/adminsv1.go index 5a0802178..6dcfb5863 100644 --- a/services/adminsv1.go +++ b/services/adminsv1.go @@ -24,8 +24,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" "github.com/cgrates/cgrates/apis" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -34,7 +34,7 @@ import ( // NewAPIerSv1Service returns the APIerSv1 Service func NewAdminSv1Service(cfg *config.CGRConfig, dm *DataDBService, storDB *StorDBService, - filterSChan chan *engine.FilterS, server *cores.Server, + filterSChan chan *engine.FilterS, server *commonlisteners.CommonListenerS, internalAPIerSv1Chan chan birpc.ClientConnector, connMgr *engine.ConnManager, anz *AnalyzerService, srvDep map[string]*sync.WaitGroup) servmanager.Service { @@ -58,7 +58,7 @@ type AdminSv1Service struct { dm *DataDBService storDB *StorDBService filterSChan chan *engine.FilterS - server *cores.Server + server *commonlisteners.CommonListenerS connMgr *engine.ConnManager api *apis.AdminSv1 diff --git a/services/analyzers.go b/services/analyzers.go index 0f14f799a..8ed57983d 100644 --- a/services/analyzers.go +++ b/services/analyzers.go @@ -25,14 +25,14 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" "github.com/cgrates/cgrates/analyzers" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" ) // NewAnalyzerService returns the Analyzer Service -func NewAnalyzerService(cfg *config.CGRConfig, server *cores.Server, +func NewAnalyzerService(cfg *config.CGRConfig, server *commonlisteners.CommonListenerS, filterSChan chan *engine.FilterS, internalAnalyzerSChan chan birpc.ClientConnector, srvDep map[string]*sync.WaitGroup) *AnalyzerService { @@ -49,7 +49,7 @@ func NewAnalyzerService(cfg *config.CGRConfig, server *cores.Server, type AnalyzerService struct { sync.RWMutex cfg *config.CGRConfig - server *cores.Server + server *commonlisteners.CommonListenerS filterSChan chan *engine.FilterS ctx *context.Context cancelFunc context.CancelFunc diff --git a/services/analyzers_it_test.go b/services/analyzers_it_test.go index c313bfcb1..d7f8742b9 100644 --- a/services/analyzers_it_test.go +++ b/services/analyzers_it_test.go @@ -30,8 +30,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -46,7 +46,7 @@ func TestAnalyzerSReload(t *testing.T) { shdWg := new(sync.WaitGroup) filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) @@ -109,7 +109,7 @@ func TestAnalyzerSReload2(t *testing.T) { } filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} anzRPC := make(chan birpc.ClientConnector, 1) anz := NewAnalyzerService(cfg, server, filterSChan, anzRPC, srvDep) @@ -136,7 +136,7 @@ func TestAnalyzerSReload3(t *testing.T) { cfg.AnalyzerSCfg().IndexType = "" filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} anzRPC := make(chan birpc.ClientConnector, 1) anz := NewAnalyzerService(cfg, server, filterSChan, anzRPC, srvDep) diff --git a/services/analyzers_test.go b/services/analyzers_test.go index 263f46d58..2ea8ab8a3 100644 --- a/services/analyzers_test.go +++ b/services/analyzers_test.go @@ -24,9 +24,9 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/cgrates/analyzers" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" ) @@ -36,7 +36,7 @@ func TestAnalyzerCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} connChan := make(chan birpc.ClientConnector, 1) anz := NewAnalyzerService(cfg, server, filterSChan, connChan, srvDep) diff --git a/services/asteriskagent_it_test.go b/services/asteriskagent_it_test.go index a53ddd91a..5da82d26a 100644 --- a/services/asteriskagent_it_test.go +++ b/services/asteriskagent_it_test.go @@ -28,8 +28,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -48,7 +48,7 @@ func TestAsteriskAgentReload(t *testing.T) { }() shdWg := new(sync.WaitGroup) - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) @@ -106,7 +106,7 @@ func TestAsteriskAgentReload2(t *testing.T) { }() shdWg := new(sync.WaitGroup) - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) diff --git a/services/attributes.go b/services/attributes.go index cb26ac6cd..9d23b198b 100644 --- a/services/attributes.go +++ b/services/attributes.go @@ -25,8 +25,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" "github.com/cgrates/cgrates/apis" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -35,7 +35,7 @@ import ( // NewAttributeService returns the Attribute Service func NewAttributeService(cfg *config.CGRConfig, dm *DataDBService, cacheS *CacheService, filterSChan chan *engine.FilterS, - server *cores.Server, internalChan chan birpc.ClientConnector, + server *commonlisteners.CommonListenerS, internalChan chan birpc.ClientConnector, anz *AnalyzerService, dspS *DispatcherService, srvDep map[string]*sync.WaitGroup) servmanager.Service { return &AttributeService{ @@ -58,7 +58,7 @@ type AttributeService struct { dm *DataDBService cacheS *CacheService filterSChan chan *engine.FilterS - server *cores.Server + server *commonlisteners.CommonListenerS attrS *engine.AttributeS rpc *apis.AttributeSv1 // useful on restart diff --git a/services/attributes_it_test.go b/services/attributes_it_test.go index 4b14de753..0bc5432ae 100644 --- a/services/attributes_it_test.go +++ b/services/attributes_it_test.go @@ -28,8 +28,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -47,7 +47,7 @@ func TestAttributeSReload(t *testing.T) { chSCh := make(chan *engine.CacheS, 1) chSCh <- chS css := &CacheService{cacheCh: chSCh} - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) diff --git a/services/attributes_test.go b/services/attributes_test.go index 9c3772c20..c4337a02d 100644 --- a/services/attributes_test.go +++ b/services/attributes_test.go @@ -24,8 +24,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" ) @@ -35,7 +35,7 @@ func TestAttributeSCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} attrRPC := make(chan birpc.ClientConnector, 1) db := NewDataDBService(cfg, nil, false, srvDep) diff --git a/services/caches.go b/services/caches.go index d91a560af..7b4081731 100644 --- a/services/caches.go +++ b/services/caches.go @@ -23,6 +23,7 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" @@ -31,7 +32,7 @@ import ( // NewCacheService . func NewCacheService(cfg *config.CGRConfig, dm *DataDBService, connMgr *engine.ConnManager, - server *cores.Server, internalChan chan birpc.ClientConnector, + server *commonlisteners.CommonListenerS, internalChan chan birpc.ClientConnector, anz *AnalyzerService, // dspS *DispatcherService, cores *CoreService, srvDep map[string]*sync.WaitGroup) *CacheService { @@ -53,7 +54,7 @@ type CacheService struct { cfg *config.CGRConfig anz *AnalyzerService cores *CoreService - server *cores.Server + server *commonlisteners.CommonListenerS dm *DataDBService connMgr *engine.ConnManager rpc chan birpc.ClientConnector diff --git a/services/cdrs.go b/services/cdrs.go index ba1ac9f79..3cf3cc89c 100644 --- a/services/cdrs.go +++ b/services/cdrs.go @@ -26,8 +26,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" "github.com/cgrates/cgrates/cdrs" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -36,7 +36,7 @@ import ( // NewCDRServer returns the CDR Server func NewCDRServer(cfg *config.CGRConfig, dm *DataDBService, storDB *StorDBService, filterSChan chan *engine.FilterS, - server *cores.Server, internalCDRServerChan chan birpc.ClientConnector, + server *commonlisteners.CommonListenerS, internalCDRServerChan chan birpc.ClientConnector, connMgr *engine.ConnManager, anz *AnalyzerService, srvDep map[string]*sync.WaitGroup) servmanager.Service { return &CDRService{ @@ -60,7 +60,7 @@ type CDRService struct { storDB *StorDBService filterSChan chan *engine.FilterS - server *cores.Server + server *commonlisteners.CommonListenerS cdrS *cdrs.CDRServer connChan chan birpc.ClientConnector diff --git a/services/cdrs_it_test.go b/services/cdrs_it_test.go index 2ac116519..d29e6fabd 100644 --- a/services/cdrs_it_test.go +++ b/services/cdrs_it_test.go @@ -28,8 +28,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -50,7 +50,7 @@ func TestCdrsReload(t *testing.T) { css := &CacheService{cacheCh: chSCh} cfg.ChargerSCfg().Enabled = true - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) diff --git a/services/cdrs_test.go b/services/cdrs_test.go index bc51640e3..65f4e4840 100644 --- a/services/cdrs_test.go +++ b/services/cdrs_test.go @@ -23,8 +23,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/cgrates/cdrs" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" ) @@ -35,7 +35,7 @@ func TestCdrsCoverage(t *testing.T) { filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil cfg.ChargerSCfg().Enabled = true - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) anz := NewAnalyzerService(cfg, server, filterSChan, make(chan birpc.ClientConnector, 1), srvDep) diff --git a/services/cgr-engine.go b/services/cgr-engine.go index 2b1c16549..36b5eb667 100644 --- a/services/cgr-engine.go +++ b/services/cgr-engine.go @@ -29,6 +29,7 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/efs" @@ -40,7 +41,7 @@ import ( ) func NewCGREngine(cfg *config.CGRConfig, cM *engine.ConnManager, shdWg *sync.WaitGroup, - server *cores.Server, caps *engine.Caps) *CGREngine { + server *commonlisteners.CommonListenerS, caps *engine.Caps) *CGREngine { return &CGREngine{ cfg: cfg, // Engine configuration cM: cM, // connection manager @@ -95,7 +96,7 @@ type CGREngine struct { srvDep map[string]*sync.WaitGroup shdWg *sync.WaitGroup cM *engine.ConnManager - server *cores.Server + server *commonlisteners.CommonListenerS caps *engine.Caps cpuPrfF *os.File diff --git a/services/chargers.go b/services/chargers.go index ba00e2402..c00300955 100644 --- a/services/chargers.go +++ b/services/chargers.go @@ -25,8 +25,8 @@ import ( "github.com/cgrates/birpc/context" "github.com/cgrates/birpc" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -34,7 +34,7 @@ import ( // NewChargerService returns the Charger Service func NewChargerService(cfg *config.CGRConfig, dm *DataDBService, - cacheS *CacheService, filterSChan chan *engine.FilterS, server *cores.Server, + cacheS *CacheService, filterSChan chan *engine.FilterS, server *commonlisteners.CommonListenerS, internalChargerSChan chan birpc.ClientConnector, connMgr *engine.ConnManager, anz *AnalyzerService, srvDep map[string]*sync.WaitGroup) servmanager.Service { return &ChargerService{ @@ -57,7 +57,7 @@ type ChargerService struct { dm *DataDBService cacheS *CacheService filterSChan chan *engine.FilterS - server *cores.Server + server *commonlisteners.CommonListenerS connMgr *engine.ConnManager chrS *engine.ChargerS diff --git a/services/chargers_it_test.go b/services/chargers_it_test.go index 1790c0691..4bde0fc11 100644 --- a/services/chargers_it_test.go +++ b/services/chargers_it_test.go @@ -29,8 +29,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -52,7 +52,7 @@ func TestChargerSReload(t *testing.T) { filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) db := NewDataDBService(cfg, nil, false, srvDep) anz := NewAnalyzerService(cfg, server, filterSChan, make(chan birpc.ClientConnector, 1), srvDep) diff --git a/services/chargers_test.go b/services/chargers_test.go index 0c1330601..063d7b493 100644 --- a/services/chargers_test.go +++ b/services/chargers_test.go @@ -24,8 +24,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" ) @@ -37,7 +37,7 @@ func TestChargerSCoverage(t *testing.T) { filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) db := NewDataDBService(cfg, nil, false, srvDep) anz := NewAnalyzerService(cfg, server, filterSChan, make(chan birpc.ClientConnector, 1), srvDep) chS := NewCacheService(cfg, db, nil, server, make(chan context.ClientConnector, 1), anz, nil, srvDep) diff --git a/services/cores.go b/services/cores.go index d450de4af..6e0d767f1 100644 --- a/services/cores.go +++ b/services/cores.go @@ -25,6 +25,7 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" @@ -32,7 +33,7 @@ import ( ) // NewCoreService returns the Core Service -func NewCoreService(cfg *config.CGRConfig, caps *engine.Caps, server *cores.Server, +func NewCoreService(cfg *config.CGRConfig, caps *engine.Caps, server *commonlisteners.CommonListenerS, internalCoreSChan chan birpc.ClientConnector, anz *AnalyzerService, fileCPU *os.File, shdWg *sync.WaitGroup, srvDep map[string]*sync.WaitGroup) *CoreService { @@ -53,7 +54,7 @@ func NewCoreService(cfg *config.CGRConfig, caps *engine.Caps, server *cores.Serv type CoreService struct { mu sync.RWMutex cfg *config.CGRConfig - server *cores.Server + server *commonlisteners.CommonListenerS caps *engine.Caps stopChan chan struct{} shdWg *sync.WaitGroup diff --git a/services/cores_it_test.go b/services/cores_it_test.go index ac573e1bd..6b4cd8103 100644 --- a/services/cores_it_test.go +++ b/services/cores_it_test.go @@ -28,8 +28,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -41,7 +41,7 @@ func TestCoreSReload(t *testing.T) { shdWg := new(sync.WaitGroup) filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) diff --git a/services/cores_test.go b/services/cores_test.go index 86535532e..bb78c1083 100644 --- a/services/cores_test.go +++ b/services/cores_test.go @@ -23,6 +23,7 @@ import ( "testing" "github.com/cgrates/birpc" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" @@ -33,7 +34,7 @@ import ( func TestCoreSCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() caps := engine.NewCaps(1, "test_caps") - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) internalCoreSChan := make(chan birpc.ClientConnector, 1) filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil diff --git a/services/datadb_it_test.go b/services/datadb_it_test.go index a68924002..348df2a38 100644 --- a/services/datadb_it_test.go +++ b/services/datadb_it_test.go @@ -29,8 +29,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -48,7 +48,7 @@ func TestDataDBReload(t *testing.T) { chSCh := make(chan *engine.CacheS, 1) chSCh <- chS css := &CacheService{cacheCh: chSCh} - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) cM := engine.NewConnManager(cfg) diff --git a/services/diameteragent_it_test.go b/services/diameteragent_it_test.go index e39dbea45..e16206db5 100644 --- a/services/diameteragent_it_test.go +++ b/services/diameteragent_it_test.go @@ -28,8 +28,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -42,7 +42,7 @@ func TestDiameterAgentReload1(t *testing.T) { filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil shdWg := new(sync.WaitGroup) - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) db := NewDataDBService(cfg, nil, false, srvDep) diff --git a/services/dispatchers.go b/services/dispatchers.go index 312a226f9..209881ab1 100644 --- a/services/dispatchers.go +++ b/services/dispatchers.go @@ -23,8 +23,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/dispatchers" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" @@ -33,7 +33,7 @@ import ( // NewDispatcherService returns the Dispatcher Service func NewDispatcherService(cfg *config.CGRConfig, dm *DataDBService, cacheS *CacheService, filterSChan chan *engine.FilterS, - server *cores.Server, internalChan chan birpc.ClientConnector, + server *commonlisteners.CommonListenerS, internalChan chan birpc.ClientConnector, connMgr *engine.ConnManager, anz *AnalyzerService, srvDep map[string]*sync.WaitGroup) *DispatcherService { return &DispatcherService{ @@ -57,7 +57,7 @@ type DispatcherService struct { dm *DataDBService cacheS *CacheService filterSChan chan *engine.FilterS - server *cores.Server + server *commonlisteners.CommonListenerS connMgr *engine.ConnManager dspS *dispatchers.DispatcherService diff --git a/services/dispatchers_it_test.go b/services/dispatchers_it_test.go index 1e881952b..479ed71ff 100644 --- a/services/dispatchers_it_test.go +++ b/services/dispatchers_it_test.go @@ -29,8 +29,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -52,7 +52,7 @@ func TestDispatcherSReload(t *testing.T) { css := &CacheService{cacheCh: chSCh} filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) diff --git a/services/dispatchers_test.go b/services/dispatchers_test.go index 18ff6a8f3..6ca8405a9 100644 --- a/services/dispatchers_test.go +++ b/services/dispatchers_test.go @@ -23,10 +23,10 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/dispatchers" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" ) @@ -37,7 +37,7 @@ func TestDispatcherSCoverage(t *testing.T) { cfg.AttributeSCfg().Enabled = true filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) anz := NewAnalyzerService(cfg, server, filterSChan, make(chan birpc.ClientConnector, 1), srvDep) diff --git a/services/dnsagent_it_test.go b/services/dnsagent_it_test.go index c29b87775..d5ab4ad1f 100644 --- a/services/dnsagent_it_test.go +++ b/services/dnsagent_it_test.go @@ -30,8 +30,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" "github.com/cgrates/cgrates/agents" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -66,7 +66,7 @@ func TestDNSAgentStartReloadShut(t *testing.T) { srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) engine.NewConnManager(cfg) db := NewDataDBService(cfg, nil, false, srvDep) - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) anz := NewAnalyzerService(cfg, server, filterSChan, make(chan birpc.ClientConnector, 1), srvDep) sS := NewSessionService(cfg, db, filterSChan, server, make(chan birpc.ClientConnector, 1), nil, anz, srvDep) @@ -109,7 +109,7 @@ func TestDNSAgentReloadFirst(t *testing.T) { }() shdWg := new(sync.WaitGroup) - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) diff --git a/services/ees.go b/services/ees.go index a45247765..e156c5791 100644 --- a/services/ees.go +++ b/services/ees.go @@ -24,8 +24,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/ees" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" @@ -34,7 +34,7 @@ import ( // NewEventExporterService constructs EventExporterService func NewEventExporterService(cfg *config.CGRConfig, filterSChan chan *engine.FilterS, - connMgr *engine.ConnManager, server *cores.Server, intConnChan chan birpc.ClientConnector, + connMgr *engine.ConnManager, server *commonlisteners.CommonListenerS, intConnChan chan birpc.ClientConnector, anz *AnalyzerService, srvDep map[string]*sync.WaitGroup) servmanager.Service { return &EventExporterService{ cfg: cfg, @@ -54,7 +54,7 @@ type EventExporterService struct { cfg *config.CGRConfig filterSChan chan *engine.FilterS connMgr *engine.ConnManager - server *cores.Server + server *commonlisteners.CommonListenerS intConnChan chan birpc.ClientConnector eeS *ees.EeS diff --git a/services/ees_it_test.go b/services/ees_it_test.go index 799765d49..e52b266d3 100644 --- a/services/ees_it_test.go +++ b/services/ees_it_test.go @@ -29,8 +29,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -52,7 +52,7 @@ func TestEventExporterSReload(t *testing.T) { filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil shdWg := new(sync.WaitGroup) - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) @@ -130,7 +130,7 @@ func TestEventExporterSReload2(t *testing.T) { cfg.AttributeSCfg().Enabled = true filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} anz := NewAnalyzerService(cfg, server, filterSChan, make(chan birpc.ClientConnector, 1), srvDep) ees := NewEventExporterService(cfg, filterSChan, engine.NewConnManager(cfg), diff --git a/services/ees_test.go b/services/ees_test.go index 0705f2559..4574d25e6 100644 --- a/services/ees_test.go +++ b/services/ees_test.go @@ -22,10 +22,10 @@ import ( "testing" "github.com/cgrates/birpc" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/ees" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" ) @@ -37,7 +37,7 @@ func TestEventExporterSCoverage(t *testing.T) { cfg.AttributeSCfg().Enabled = true filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} anz := NewAnalyzerService(cfg, server, filterSChan, make(chan birpc.ClientConnector, 1), srvDep) srv := NewEventExporterService(cfg, filterSChan, engine.NewConnManager(cfg), server, make(chan birpc.ClientConnector, 1), anz, srvDep) diff --git a/services/efs.go b/services/efs.go index b6eb9fe19..1b1eb90cd 100644 --- a/services/efs.go +++ b/services/efs.go @@ -25,8 +25,8 @@ import ( "github.com/cgrates/birpc/context" "github.com/cgrates/birpc" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/efs" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" @@ -38,7 +38,7 @@ type ExportFailoverService struct { cfg *config.CGRConfig connMgr *engine.ConnManager - server *cores.Server + server *commonlisteners.CommonListenerS srv *birpc.Service intConnChan chan birpc.ClientConnector stopChan chan struct{} @@ -50,7 +50,7 @@ type ExportFailoverService struct { // NewExportFailoverService is the constructor for the TpeService func NewExportFailoverService(cfg *config.CGRConfig, connMgr *engine.ConnManager, intConnChan chan birpc.ClientConnector, - server *cores.Server, srvDep map[string]*sync.WaitGroup) *ExportFailoverService { + server *commonlisteners.CommonListenerS, srvDep map[string]*sync.WaitGroup) *ExportFailoverService { return &ExportFailoverService{ cfg: cfg, server: server, diff --git a/services/ers.go b/services/ers.go index 83631de5d..e4ffd453a 100644 --- a/services/ers.go +++ b/services/ers.go @@ -24,8 +24,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/ers" "github.com/cgrates/cgrates/servmanager" @@ -37,7 +37,7 @@ func NewEventReaderService( cfg *config.CGRConfig, filterSChan chan *engine.FilterS, connMgr *engine.ConnManager, - server *cores.Server, + server *commonlisteners.CommonListenerS, intConn chan birpc.ClientConnector, anz *AnalyzerService, srvDep map[string]*sync.WaitGroup) servmanager.Service { @@ -63,7 +63,7 @@ type EventReaderService struct { rldChan chan struct{} stopChan chan struct{} connMgr *engine.ConnManager - server *cores.Server + server *commonlisteners.CommonListenerS intConn chan birpc.ClientConnector anz *AnalyzerService srvDep map[string]*sync.WaitGroup diff --git a/services/ers_it_test.go b/services/ers_it_test.go index d13ccb0f3..80012cbb1 100644 --- a/services/ers_it_test.go +++ b/services/ers_it_test.go @@ -30,8 +30,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/ers" "github.com/cgrates/cgrates/servmanager" @@ -59,7 +59,7 @@ func TestEventReaderSReload(t *testing.T) { time.Sleep(10 * time.Millisecond) }() shdWg := new(sync.WaitGroup) - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} anz := NewAnalyzerService(cfg, server, filterSChan, make(chan birpc.ClientConnector, 1), srvDep) @@ -128,7 +128,7 @@ func TestEventReaderSReload2(t *testing.T) { filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) erS := NewEventReaderService(cfg, filterSChan, nil, server, nil, nil, srvDep) ers := ers.NewERService(cfg, nil, nil) diff --git a/services/ers_test.go b/services/ers_test.go index 050143c04..a4a98af9a 100644 --- a/services/ers_test.go +++ b/services/ers_test.go @@ -22,7 +22,7 @@ import ( "sync" "testing" - "github.com/cgrates/cgrates/cores" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/ers" "github.com/cgrates/cgrates/config" @@ -37,7 +37,7 @@ func TestEventReaderSCoverage(t *testing.T) { filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srv := NewEventReaderService(cfg, filterSChan, nil, server, nil, nil, srvDep) if srv.IsRunning() { diff --git a/services/freeswitchagent_it_test.go b/services/freeswitchagent_it_test.go index f11405fb0..00b38d1f0 100644 --- a/services/freeswitchagent_it_test.go +++ b/services/freeswitchagent_it_test.go @@ -29,8 +29,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" "github.com/cgrates/cgrates/agents" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -50,7 +50,7 @@ func TestFreeSwitchAgentReload(t *testing.T) { }() shdWg := new(sync.WaitGroup) - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) diff --git a/services/httpagent.go b/services/httpagent.go index c3f64ae2a..108d7890e 100644 --- a/services/httpagent.go +++ b/services/httpagent.go @@ -24,8 +24,8 @@ import ( "github.com/cgrates/birpc/context" "github.com/cgrates/cgrates/agents" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -33,7 +33,7 @@ import ( // NewHTTPAgent returns the HTTP Agent func NewHTTPAgent(cfg *config.CGRConfig, filterSChan chan *engine.FilterS, - server *cores.Server, connMgr *engine.ConnManager, + server *commonlisteners.CommonListenerS, connMgr *engine.ConnManager, srvDep map[string]*sync.WaitGroup) servmanager.Service { return &HTTPAgent{ cfg: cfg, @@ -49,7 +49,7 @@ type HTTPAgent struct { sync.RWMutex cfg *config.CGRConfig filterSChan chan *engine.FilterS - server *cores.Server + server *commonlisteners.CommonListenerS // we can realy stop the HTTPAgent so keep a flag // if we registerd the handlers diff --git a/services/httpagent_it_test.go b/services/httpagent_it_test.go index e67dbed4c..ec6e20c35 100644 --- a/services/httpagent_it_test.go +++ b/services/httpagent_it_test.go @@ -29,8 +29,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -48,7 +48,7 @@ func TestHTTPAgentReload(t *testing.T) { time.Sleep(10 * time.Millisecond) }() shdWg := new(sync.WaitGroup) - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) diff --git a/services/httpagent_test.go b/services/httpagent_test.go index 4f7abca6c..809c9f719 100644 --- a/services/httpagent_test.go +++ b/services/httpagent_test.go @@ -22,8 +22,8 @@ import ( "sync" "testing" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" ) @@ -31,7 +31,7 @@ import ( // TestHTTPAgent for cover testing func TestHTTPAgentCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} diff --git a/services/janus.go b/services/janus.go index bcfddf6f0..135749da6 100644 --- a/services/janus.go +++ b/services/janus.go @@ -25,8 +25,8 @@ import ( "github.com/cgrates/birpc/context" "github.com/cgrates/cgrates/agents" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -34,7 +34,7 @@ import ( // NewJanusAgent returns the Janus Agent func NewJanusAgent(cfg *config.CGRConfig, filterSChan chan *engine.FilterS, - server *cores.Server, connMgr *engine.ConnManager, + server *commonlisteners.CommonListenerS, connMgr *engine.ConnManager, srvDep map[string]*sync.WaitGroup) servmanager.Service { return &JanusAgent{ cfg: cfg, @@ -50,7 +50,7 @@ type JanusAgent struct { sync.RWMutex cfg *config.CGRConfig filterSChan chan *engine.FilterS - server *cores.Server + server *commonlisteners.CommonListenerS jA *agents.JanusAgent // we can realy stop the JanusAgent so keep a flag diff --git a/services/kamailioagent_it_test.go b/services/kamailioagent_it_test.go index c08b264ea..73c4e8505 100644 --- a/services/kamailioagent_it_test.go +++ b/services/kamailioagent_it_test.go @@ -30,9 +30,9 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" "github.com/cgrates/cgrates/agents" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -47,7 +47,7 @@ func TestKamailioAgentReload(t *testing.T) { filterSChan <- nil shdWg := new(sync.WaitGroup) - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) diff --git a/services/libcgr-engine.go b/services/libcgr-engine.go index 04c21fee2..af7d12daf 100644 --- a/services/libcgr-engine.go +++ b/services/libcgr-engine.go @@ -32,8 +32,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" "github.com/cgrates/cgrates/apis" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/guardian" "github.com/cgrates/cgrates/loaders" @@ -185,7 +185,7 @@ func cgrStartFilterService(ctx *context.Context, iFilterSCh chan *engine.FilterS } func cgrInitGuardianSv1(iGuardianSCh chan birpc.ClientConnector, cfg *config.CGRConfig, - server *cores.Server, anz *AnalyzerService) { + server *commonlisteners.CommonListenerS, anz *AnalyzerService) { srv, _ := engine.NewServiceWithName(guardian.Guardian, utils.GuardianS, true) if !cfg.DispatcherSCfg().Enabled { for _, s := range srv { @@ -197,7 +197,7 @@ func cgrInitGuardianSv1(iGuardianSCh chan birpc.ClientConnector, cfg *config.CGR func cgrInitServiceManagerV1(iServMngrCh chan birpc.ClientConnector, srvMngr *servmanager.ServiceManager, cfg *config.CGRConfig, - server *cores.Server, anz *AnalyzerService) { + server *commonlisteners.CommonListenerS, anz *AnalyzerService) { srv, _ := birpc.NewService(apis.NewServiceManagerV1(srvMngr), utils.EmptyString, false) if !cfg.DispatcherSCfg().Enabled { server.RpcRegister(srv) @@ -206,7 +206,7 @@ func cgrInitServiceManagerV1(iServMngrCh chan birpc.ClientConnector, } func cgrInitConfigSv1(iConfigCh chan birpc.ClientConnector, - cfg *config.CGRConfig, server *cores.Server, anz *AnalyzerService) { + cfg *config.CGRConfig, server *commonlisteners.CommonListenerS, anz *AnalyzerService) { srv, _ := engine.NewServiceWithName(cfg, utils.ConfigS, true) // srv, _ := birpc.NewService(apis.NewConfigSv1(cfg), "", false) if !cfg.DispatcherSCfg().Enabled { @@ -218,7 +218,7 @@ func cgrInitConfigSv1(iConfigCh chan birpc.ClientConnector, } func cgrStartRPC(ctx *context.Context, shtdwnEngine context.CancelFunc, - cfg *config.CGRConfig, server *cores.Server, internalDispatcherSChan chan birpc.ClientConnector) { + cfg *config.CGRConfig, server *commonlisteners.CommonListenerS, internalDispatcherSChan chan birpc.ClientConnector) { if cfg.DispatcherSCfg().Enabled { // wait only for dispatcher as cache is allways registered before this select { case dispatcherS := <-internalDispatcherSChan: diff --git a/services/loaders.go b/services/loaders.go index 48ed7e1eb..448437495 100644 --- a/services/loaders.go +++ b/services/loaders.go @@ -24,8 +24,8 @@ import ( "github.com/cgrates/birpc/context" "github.com/cgrates/birpc" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/loaders" "github.com/cgrates/cgrates/utils" @@ -33,7 +33,7 @@ import ( // NewLoaderService returns the Loader Service func NewLoaderService(cfg *config.CGRConfig, dm *DataDBService, - filterSChan chan *engine.FilterS, server *cores.Server, + filterSChan chan *engine.FilterS, server *commonlisteners.CommonListenerS, internalLoaderSChan chan birpc.ClientConnector, connMgr *engine.ConnManager, anz *AnalyzerService, srvDep map[string]*sync.WaitGroup) *LoaderService { @@ -56,7 +56,7 @@ type LoaderService struct { cfg *config.CGRConfig dm *DataDBService filterSChan chan *engine.FilterS - server *cores.Server + server *commonlisteners.CommonListenerS stopChan chan struct{} ldrs *loaders.LoaderS diff --git a/services/loaders_it_test.go b/services/loaders_it_test.go index f3510aa1e..a8bd38a5a 100644 --- a/services/loaders_it_test.go +++ b/services/loaders_it_test.go @@ -29,8 +29,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -70,7 +70,7 @@ func TestLoaderSReload(t *testing.T) { shdWg := new(sync.WaitGroup) filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) @@ -150,7 +150,7 @@ func TestLoaderSReload2(t *testing.T) { } filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) db.dbchan <- new(engine.DataManager) @@ -175,7 +175,7 @@ func TestLoaderSReload3(t *testing.T) { cfg.LoaderCfg()[0].RunDelay = -1 filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) db.dbchan <- new(engine.DataManager) diff --git a/services/loaders_test.go b/services/loaders_test.go index 198aa0c1f..0817e8924 100644 --- a/services/loaders_test.go +++ b/services/loaders_test.go @@ -23,8 +23,8 @@ import ( "testing" "github.com/cgrates/birpc" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/loaders" "github.com/cgrates/cgrates/utils" @@ -35,7 +35,7 @@ func TestLoaderSCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) internalLoaderSChan := make(chan birpc.ClientConnector, 1) diff --git a/services/radiusagent_it_test.go b/services/radiusagent_it_test.go index 56374dfea..e464527cf 100644 --- a/services/radiusagent_it_test.go +++ b/services/radiusagent_it_test.go @@ -30,8 +30,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" "github.com/cgrates/cgrates/agents" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -51,7 +51,7 @@ func TestRadiusAgentReload(t *testing.T) { }() shdWg := new(sync.WaitGroup) - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) @@ -111,7 +111,7 @@ func TestRadiusAgentReload2(t *testing.T) { }() shdWg := new(sync.WaitGroup) - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) diff --git a/services/rankings.go b/services/rankings.go index 1f07ebf40..a77a1fcd1 100644 --- a/services/rankings.go +++ b/services/rankings.go @@ -25,8 +25,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -35,7 +35,7 @@ import ( // NewRankingService returns the RankingS Service func NewRankingService(cfg *config.CGRConfig, dm *DataDBService, cacheS *CacheService, filterSChan chan *engine.FilterS, - server *cores.Server, internalRankingSChan chan birpc.ClientConnector, + server *commonlisteners.CommonListenerS, internalRankingSChan chan birpc.ClientConnector, connMgr *engine.ConnManager, anz *AnalyzerService, srvDep map[string]*sync.WaitGroup) servmanager.Service { return &RankingService{ @@ -57,7 +57,7 @@ type RankingService struct { dm *DataDBService cacheS *CacheService filterSChan chan *engine.FilterS - server *cores.Server + server *commonlisteners.CommonListenerS connMgr *engine.ConnManager connChan chan birpc.ClientConnector anz *AnalyzerService diff --git a/services/rankings_test.go b/services/rankings_test.go index d989c0c5c..032851cf6 100644 --- a/services/rankings_test.go +++ b/services/rankings_test.go @@ -23,8 +23,8 @@ import ( "testing" "github.com/cgrates/birpc" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" ) @@ -35,7 +35,7 @@ func TestNewRankingService(t *testing.T) { cacheS := &CacheService{} filterSChan := make(chan *engine.FilterS) birpc := make(chan birpc.ClientConnector) - server := &cores.Server{} + server := &commonlisteners.CommonListenerS{} connMgr := &engine.ConnManager{} anz := &AnalyzerService{} srvDep := make(map[string]*sync.WaitGroup) diff --git a/services/rates.go b/services/rates.go index 28bc639c4..19f57d0ee 100644 --- a/services/rates.go +++ b/services/rates.go @@ -23,8 +23,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/rates" "github.com/cgrates/cgrates/servmanager" @@ -34,7 +34,7 @@ import ( // NewRateService constructs RateService func NewRateService(cfg *config.CGRConfig, cacheS *CacheService, filterSChan chan *engine.FilterS, - dmS *DataDBService, server *cores.Server, + dmS *DataDBService, server *commonlisteners.CommonListenerS, intConnChan chan birpc.ClientConnector, anz *AnalyzerService, srvDep map[string]*sync.WaitGroup) servmanager.Service { return &RateService{ @@ -58,7 +58,7 @@ type RateService struct { filterSChan chan *engine.FilterS dmS *DataDBService cacheS *CacheService - server *cores.Server + server *commonlisteners.CommonListenerS rldChan chan struct{} stopChan chan struct{} diff --git a/services/rates_it_test.go b/services/rates_it_test.go index 3b66bab3b..29a633d0c 100644 --- a/services/rates_it_test.go +++ b/services/rates_it_test.go @@ -29,8 +29,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -42,7 +42,7 @@ func TestRateSReload(t *testing.T) { filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil shdWg := new(sync.WaitGroup) - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) diff --git a/services/rates_test.go b/services/rates_test.go index 398df1b41..73d145508 100644 --- a/services/rates_test.go +++ b/services/rates_test.go @@ -24,10 +24,10 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/rates" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" ) @@ -37,7 +37,7 @@ func TestRateSCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) anz := NewAnalyzerService(cfg, server, filterSChan, make(chan birpc.ClientConnector, 1), srvDep) diff --git a/services/registrarc.go b/services/registrarc.go index 399d2da44..50cd1347f 100644 --- a/services/registrarc.go +++ b/services/registrarc.go @@ -22,8 +22,8 @@ import ( "sync" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/registrarc" "github.com/cgrates/cgrates/servmanager" @@ -31,7 +31,7 @@ import ( ) // NewRegistrarCService returns the Dispatcher Service -func NewRegistrarCService(cfg *config.CGRConfig, server *cores.Server, +func NewRegistrarCService(cfg *config.CGRConfig, server *commonlisteners.CommonListenerS, connMgr *engine.ConnManager, anz *AnalyzerService, srvDep map[string]*sync.WaitGroup) servmanager.Service { return &RegistrarCService{ @@ -47,7 +47,7 @@ func NewRegistrarCService(cfg *config.CGRConfig, server *cores.Server, type RegistrarCService struct { sync.RWMutex cfg *config.CGRConfig - server *cores.Server + server *commonlisteners.CommonListenerS connMgr *engine.ConnManager stopChan chan struct{} rldChan chan struct{} diff --git a/services/registrarc_it_test.go b/services/registrarc_it_test.go index 7b86206be..b38401b7e 100644 --- a/services/registrarc_it_test.go +++ b/services/registrarc_it_test.go @@ -30,8 +30,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -50,7 +50,7 @@ func TestDispatcherHReload(t *testing.T) { shdWg := new(sync.WaitGroup) filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) diff --git a/services/registrarc_test.go b/services/registrarc_test.go index ae02f21e8..f0f1e2107 100644 --- a/services/registrarc_test.go +++ b/services/registrarc_test.go @@ -23,8 +23,8 @@ import ( "testing" "github.com/cgrates/birpc" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/registrarc" "github.com/cgrates/cgrates/utils" @@ -35,7 +35,7 @@ func TestDispatcherHCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} anz := NewAnalyzerService(cfg, server, filterSChan, make(chan birpc.ClientConnector, 1), srvDep) cM := engine.NewConnManager(cfg) diff --git a/services/resources.go b/services/resources.go index 02d3d5ce9..5da084676 100644 --- a/services/resources.go +++ b/services/resources.go @@ -24,8 +24,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -34,7 +34,7 @@ import ( // NewResourceService returns the Resource Service func NewResourceService(cfg *config.CGRConfig, dm *DataDBService, cacheS *CacheService, filterSChan chan *engine.FilterS, - server *cores.Server, internalResourceSChan chan birpc.ClientConnector, + server *commonlisteners.CommonListenerS, internalResourceSChan chan birpc.ClientConnector, connMgr *engine.ConnManager, anz *AnalyzerService, srvDep map[string]*sync.WaitGroup) servmanager.Service { return &ResourceService{ @@ -57,7 +57,7 @@ type ResourceService struct { dm *DataDBService cacheS *CacheService filterSChan chan *engine.FilterS - server *cores.Server + server *commonlisteners.CommonListenerS reS *engine.ResourceS connChan chan birpc.ClientConnector diff --git a/services/resources_it_test.go b/services/resources_it_test.go index 480d71f18..472a6794c 100644 --- a/services/resources_it_test.go +++ b/services/resources_it_test.go @@ -29,8 +29,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -54,7 +54,7 @@ func TestResourceSReload(t *testing.T) { chSCh := make(chan *engine.CacheS, 1) chSCh <- chS css := &CacheService{cacheCh: chSCh} - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} anz := NewAnalyzerService(cfg, server, filterSChan, make(chan birpc.ClientConnector, 1), srvDep) diff --git a/services/resources_test.go b/services/resources_test.go index f92225f95..b547a4228 100644 --- a/services/resources_test.go +++ b/services/resources_test.go @@ -24,8 +24,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" ) @@ -36,7 +36,7 @@ func TestResourceSCoverage(t *testing.T) { cfg.ThresholdSCfg().Enabled = true filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} anz := NewAnalyzerService(cfg, server, filterSChan, make(chan birpc.ClientConnector, 1), srvDep) db := NewDataDBService(cfg, nil, false, srvDep) diff --git a/services/routes.go b/services/routes.go index 9e4fe1dfb..759d20568 100644 --- a/services/routes.go +++ b/services/routes.go @@ -25,8 +25,8 @@ import ( "github.com/cgrates/birpc/context" "github.com/cgrates/birpc" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -35,7 +35,7 @@ import ( // NewRouteService returns the Route Service func NewRouteService(cfg *config.CGRConfig, dm *DataDBService, cacheS *CacheService, filterSChan chan *engine.FilterS, - server *cores.Server, internalRouteSChan chan birpc.ClientConnector, + server *commonlisteners.CommonListenerS, internalRouteSChan chan birpc.ClientConnector, connMgr *engine.ConnManager, anz *AnalyzerService, srvDep map[string]*sync.WaitGroup) servmanager.Service { return &RouteService{ @@ -58,7 +58,7 @@ type RouteService struct { dm *DataDBService cacheS *CacheService filterSChan chan *engine.FilterS - server *cores.Server + server *commonlisteners.CommonListenerS connMgr *engine.ConnManager routeS *engine.RouteS diff --git a/services/routes_it_test.go b/services/routes_it_test.go index a9b158ecf..e6455dd7e 100644 --- a/services/routes_it_test.go +++ b/services/routes_it_test.go @@ -29,8 +29,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -49,7 +49,7 @@ func TestRouteSReload(t *testing.T) { chSCh := make(chan *engine.CacheS, 1) chSCh <- chS css := &CacheService{cacheCh: chSCh} - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} anz := NewAnalyzerService(cfg, server, filterSChan, make(chan birpc.ClientConnector, 1), srvDep) diff --git a/services/routes_test.go b/services/routes_test.go index 4ff99a8d3..970455bda 100644 --- a/services/routes_test.go +++ b/services/routes_test.go @@ -24,8 +24,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" ) @@ -36,7 +36,7 @@ func TestSupplierSCoverage(t *testing.T) { cfg.StatSCfg().Enabled = true filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) anz := NewAnalyzerService(cfg, server, filterSChan, make(chan birpc.ClientConnector, 1), srvDep) diff --git a/services/sessions.go b/services/sessions.go index fd11cd5a2..42fe68fca 100644 --- a/services/sessions.go +++ b/services/sessions.go @@ -25,7 +25,7 @@ import ( "github.com/cgrates/birpc/context" "github.com/cgrates/birpc" - "github.com/cgrates/cgrates/cores" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/config" @@ -36,7 +36,7 @@ import ( // NewSessionService returns the Session Service func NewSessionService(cfg *config.CGRConfig, dm *DataDBService, filterSChan chan *engine.FilterS, - server *cores.Server, internalChan chan birpc.ClientConnector, + server *commonlisteners.CommonListenerS, internalChan chan birpc.ClientConnector, connMgr *engine.ConnManager, anz *AnalyzerService, srvDep map[string]*sync.WaitGroup) servmanager.Service { return &SessionService{ @@ -57,7 +57,7 @@ type SessionService struct { cfg *config.CGRConfig dm *DataDBService filterSChan chan *engine.FilterS - server *cores.Server + server *commonlisteners.CommonListenerS stopChan chan struct{} sm *sessions.SessionS diff --git a/services/sessions_it_test.go b/services/sessions_it_test.go index 2e6ac2293..e6e2dc5ea 100644 --- a/services/sessions_it_test.go +++ b/services/sessions_it_test.go @@ -30,8 +30,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/sessions" "github.com/cgrates/cgrates/utils" @@ -63,7 +63,7 @@ func TestSessionSReload1(t *testing.T) { engine.Cache = engine.NewCacheS(cfg, nil, nil, nil) filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} clientConect := make(chan birpc.ClientConnector, 1) @@ -153,7 +153,7 @@ func TestSessionSReload2(t *testing.T) { internalChan := make(chan birpc.ClientConnector, 1) internalChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) @@ -199,7 +199,7 @@ func TestSessionSReload3(t *testing.T) { internalChan := make(chan birpc.ClientConnector, 1) internalChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) diff --git a/services/sessions_test.go b/services/sessions_test.go index 9dd4cbd97..fbd05b95c 100644 --- a/services/sessions_test.go +++ b/services/sessions_test.go @@ -24,10 +24,10 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/sessions" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" ) @@ -47,7 +47,7 @@ func TestSessionSCoverage(t *testing.T) { cfg.CdrsCfg().Enabled = true filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) anz := NewAnalyzerService(cfg, server, filterSChan, make(chan birpc.ClientConnector, 1), srvDep) diff --git a/services/sipagent_it_test.go b/services/sipagent_it_test.go index d070e7462..9fc079547 100644 --- a/services/sipagent_it_test.go +++ b/services/sipagent_it_test.go @@ -29,8 +29,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -45,7 +45,7 @@ func TestSIPAgentReload(t *testing.T) { filterSChan <- nil shdWg := new(sync.WaitGroup) - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} db := NewDataDBService(cfg, nil, false, srvDep) diff --git a/services/stats.go b/services/stats.go index 5a8d0ddd5..1d382a969 100644 --- a/services/stats.go +++ b/services/stats.go @@ -24,8 +24,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -34,7 +34,7 @@ import ( // NewStatService returns the Stat Service func NewStatService(cfg *config.CGRConfig, dm *DataDBService, cacheS *CacheService, filterSChan chan *engine.FilterS, - server *cores.Server, internalStatSChan chan birpc.ClientConnector, + server *commonlisteners.CommonListenerS, internalStatSChan chan birpc.ClientConnector, connMgr *engine.ConnManager, anz *AnalyzerService, srvDep map[string]*sync.WaitGroup) servmanager.Service { return &StatService{ @@ -57,7 +57,7 @@ type StatService struct { dm *DataDBService cacheS *CacheService filterSChan chan *engine.FilterS - server *cores.Server + server *commonlisteners.CommonListenerS connMgr *engine.ConnManager sts *engine.StatS diff --git a/services/stats_it_test.go b/services/stats_it_test.go index 7ac96a0f5..4991173da 100644 --- a/services/stats_it_test.go +++ b/services/stats_it_test.go @@ -29,8 +29,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -54,7 +54,7 @@ func TestStatSReload(t *testing.T) { chSCh := make(chan *engine.CacheS, 1) chSCh <- chS css := &CacheService{cacheCh: chSCh} - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} anz := NewAnalyzerService(cfg, server, filterSChan, make(chan birpc.ClientConnector, 1), srvDep) diff --git a/services/stats_test.go b/services/stats_test.go index 10bc8250b..0f89cc533 100644 --- a/services/stats_test.go +++ b/services/stats_test.go @@ -24,8 +24,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" ) @@ -37,7 +37,7 @@ func TestStatSCoverage(t *testing.T) { cfg.ThresholdSCfg().Enabled = true filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} anz := NewAnalyzerService(cfg, server, filterSChan, make(chan birpc.ClientConnector, 1), srvDep) db := NewDataDBService(cfg, nil, false, srvDep) diff --git a/services/thresholds.go b/services/thresholds.go index fd6ae1ec4..764efe32e 100644 --- a/services/thresholds.go +++ b/services/thresholds.go @@ -24,8 +24,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -35,7 +35,7 @@ import ( func NewThresholdService(cfg *config.CGRConfig, dm *DataDBService, cacheS *CacheService, filterSChan chan *engine.FilterS, connMgr *engine.ConnManager, - server *cores.Server, internalThresholdSChan chan birpc.ClientConnector, + server *commonlisteners.CommonListenerS, internalThresholdSChan chan birpc.ClientConnector, anz *AnalyzerService, srvDep map[string]*sync.WaitGroup) servmanager.Service { return &ThresholdService{ connChan: internalThresholdSChan, @@ -57,7 +57,7 @@ type ThresholdService struct { dm *DataDBService cacheS *CacheService filterSChan chan *engine.FilterS - server *cores.Server + server *commonlisteners.CommonListenerS connMgr *engine.ConnManager thrs *engine.ThresholdS diff --git a/services/thresholds_it_test.go b/services/thresholds_it_test.go index ff61e95a8..925f4fd85 100644 --- a/services/thresholds_it_test.go +++ b/services/thresholds_it_test.go @@ -29,8 +29,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -50,7 +50,7 @@ func TestThresholdSReload(t *testing.T) { chSCh := make(chan *engine.CacheS, 1) chSCh <- chS css := &CacheService{cacheCh: chSCh} - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} anz := NewAnalyzerService(cfg, server, filterSChan, make(chan birpc.ClientConnector, 1), srvDep) @@ -119,7 +119,7 @@ func TestThresholdSReload2(t *testing.T) { chSCh := make(chan *engine.CacheS, 1) chSCh <- chS css := &CacheService{cacheCh: chSCh} - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvMngr := servmanager.NewServiceManager(shdWg, nil, cfg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} anz := NewAnalyzerService(cfg, server, filterSChan, make(chan birpc.ClientConnector, 1), srvDep) diff --git a/services/thresholds_test.go b/services/thresholds_test.go index 131a71b3a..7081d800d 100644 --- a/services/thresholds_test.go +++ b/services/thresholds_test.go @@ -24,8 +24,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" ) @@ -35,7 +35,7 @@ func TestThresholdSCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - server := cores.NewServer(nil) + server := commonlisteners.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} anz := NewAnalyzerService(cfg, server, filterSChan, make(chan birpc.ClientConnector, 1), srvDep) db := NewDataDBService(cfg, nil, false, srvDep) diff --git a/services/tpes.go b/services/tpes.go index bd795c21d..13073c63c 100644 --- a/services/tpes.go +++ b/services/tpes.go @@ -24,8 +24,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" "github.com/cgrates/cgrates/apis" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/tpes" @@ -34,7 +34,7 @@ import ( // NewTPeService is the constructor for the TpeService func NewTPeService(cfg *config.CGRConfig, connMgr *engine.ConnManager, dm *DataDBService, - server *cores.Server, srvDep map[string]*sync.WaitGroup) servmanager.Service { + server *commonlisteners.CommonListenerS, srvDep map[string]*sync.WaitGroup) servmanager.Service { return &TPeService{ cfg: cfg, srvDep: srvDep, @@ -49,7 +49,7 @@ type TPeService struct { sync.RWMutex cfg *config.CGRConfig - server *cores.Server + server *commonlisteners.CommonListenerS connMgr *engine.ConnManager tpes *tpes.TPeS dm *DataDBService diff --git a/services/trends.go b/services/trends.go index ebb775e5c..7516bb97c 100644 --- a/services/trends.go +++ b/services/trends.go @@ -24,8 +24,8 @@ import ( "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" @@ -34,7 +34,7 @@ import ( // NewTrendsService returns the TrendS Service func NewTrendService(cfg *config.CGRConfig, dm *DataDBService, cacheS *CacheService, filterSChan chan *engine.FilterS, - server *cores.Server, internalTrendSChan chan birpc.ClientConnector, + server *commonlisteners.CommonListenerS, internalTrendSChan chan birpc.ClientConnector, connMgr *engine.ConnManager, anz *AnalyzerService, srvDep map[string]*sync.WaitGroup) servmanager.Service { return &TrendService{ @@ -54,7 +54,7 @@ type TrendService struct { cfg *config.CGRConfig dm *DataDBService cacheS *CacheService - server *cores.Server + server *commonlisteners.CommonListenerS connMgr *engine.ConnManager filterSChan chan *engine.FilterS connChan chan birpc.ClientConnector diff --git a/services/trends_test.go b/services/trends_test.go index 43be6ec66..10a2baa49 100644 --- a/services/trends_test.go +++ b/services/trends_test.go @@ -23,8 +23,8 @@ import ( "testing" "github.com/cgrates/birpc" + "github.com/cgrates/cgrates/commonlisteners" "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" ) @@ -34,7 +34,7 @@ func TestNewTrendService(t *testing.T) { dm := &DataDBService{} cacheS := &CacheService{} filterSChan := make(chan *engine.FilterS) - server := &cores.Server{} + server := &commonlisteners.CommonListenerS{} internalTrendSChan := make(chan birpc.ClientConnector) connMgr := &engine.ConnManager{} anz := &AnalyzerService{}