mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-20 14:48:43 +05:00
Added RadiusAgent as service in ServiceManager
This commit is contained in:
committed by
Dan Christian Bogos
parent
411579d1fc
commit
ff24cbac51
@@ -194,42 +194,6 @@ func startDiameterAgent(internalSsChan, internalDispatcherSChan chan rpcclient.R
|
||||
exitChan <- true
|
||||
}
|
||||
|
||||
func startRadiusAgent(internalSMGChan, internalDispatcherSChan chan rpcclient.RpcClientConnection,
|
||||
filterSChan chan *engine.FilterS, exitChan chan bool) {
|
||||
filterS := <-filterSChan
|
||||
filterSChan <- filterS
|
||||
utils.Logger.Info("Starting CGRateS RadiusAgent service")
|
||||
var err error
|
||||
var smgConn rpcclient.RpcClientConnection
|
||||
intSMGChan := internalSMGChan
|
||||
if cfg.DispatcherSCfg().Enabled {
|
||||
intSMGChan = internalDispatcherSChan
|
||||
}
|
||||
|
||||
smgConn, err = engine.NewRPCPool(rpcclient.POOL_FIRST,
|
||||
cfg.TlsCfg().ClientKey,
|
||||
cfg.TlsCfg().ClientCerificate, cfg.TlsCfg().CaCertificate,
|
||||
cfg.GeneralCfg().ConnectAttempts, cfg.GeneralCfg().Reconnects,
|
||||
cfg.GeneralCfg().ConnectTimeout, cfg.GeneralCfg().ReplyTimeout,
|
||||
cfg.RadiusAgentCfg().SessionSConns, intSMGChan, false)
|
||||
if err != nil {
|
||||
utils.Logger.Crit(fmt.Sprintf("<%s> Could not connect to SMG: %s", utils.RadiusAgent, err.Error()))
|
||||
exitChan <- true
|
||||
return
|
||||
}
|
||||
|
||||
ra, err := agents.NewRadiusAgent(cfg, filterS, smgConn)
|
||||
if err != nil {
|
||||
utils.Logger.Err(fmt.Sprintf("<%s> error: <%s>", utils.RadiusAgent, err.Error()))
|
||||
exitChan <- true
|
||||
return
|
||||
}
|
||||
if err = ra.ListenAndServe(); err != nil {
|
||||
utils.Logger.Err(fmt.Sprintf("<%s> error: <%s>", utils.RadiusAgent, err.Error()))
|
||||
}
|
||||
exitChan <- true
|
||||
}
|
||||
|
||||
func startHTTPAgent(internalSMGChan, internalDispatcherSChan chan rpcclient.RpcClientConnection,
|
||||
server *utils.Server, filterSChan chan *engine.FilterS, dfltTenant string, exitChan chan bool) {
|
||||
filterS := <-filterSChan
|
||||
@@ -798,7 +762,8 @@ func main() {
|
||||
services.NewDNSAgent(),
|
||||
services.NewFreeswitchAgent(),
|
||||
services.NewKamailioAgent(),
|
||||
services.NewAsteriskAgent(),
|
||||
services.NewAsteriskAgent(), // partial reload
|
||||
services.NewRadiusAgent(), // partial reload
|
||||
)
|
||||
internalAttributeSChan := attrS.GetIntenternalChan()
|
||||
internalChargerSChan := chrS.GetIntenternalChan()
|
||||
@@ -855,10 +820,6 @@ func main() {
|
||||
go startDiameterAgent(internalSMGChan, internalDispatcherSChan, filterSChan, exitChan)
|
||||
}
|
||||
|
||||
if cfg.RadiusAgentCfg().Enabled {
|
||||
go startRadiusAgent(internalSMGChan, internalDispatcherSChan, filterSChan, exitChan)
|
||||
}
|
||||
|
||||
if len(cfg.HttpAgentCfg()) != 0 {
|
||||
go startHTTPAgent(internalSMGChan, internalDispatcherSChan, server, filterSChan,
|
||||
cfg.GeneralCfg().DefaultTenant, exitChan)
|
||||
|
||||
Reference in New Issue
Block a user