Remove unused parameters from fs connect func

This commit is contained in:
ionutboangiu
2024-09-20 18:58:18 +03:00
committed by Dan Christian Bogos
parent a0ba8e352b
commit da8c468c0c
2 changed files with 3 additions and 39 deletions

View File

@@ -63,7 +63,7 @@ func (fS *FreeswitchAgent) Start(_ *context.Context, shtDwn context.CancelFunc)
fS.fS = agents.NewFSsessions(fS.cfg.FsAgentCfg(), fS.cfg.GeneralCfg().DefaultTimezone, fS.connMgr)
go fS.connect(fS.fS, shtDwn)
go fS.connect(shtDwn)
return
}
@@ -75,11 +75,11 @@ func (fS *FreeswitchAgent) Reload(_ *context.Context, shtDwn context.CancelFunc)
return
}
fS.fS.Reload()
go fS.connect(fS.fS, shtDwn)
go fS.connect(shtDwn)
return
}
func (fS *FreeswitchAgent) connect(f *agents.FSsessions, shtDwn context.CancelFunc) (err error) {
func (fS *FreeswitchAgent) connect(shtDwn context.CancelFunc) {
if err := fS.fS.Connect(); err != nil {
utils.Logger.Err(fmt.Sprintf("<%s> error: %s!", utils.FreeSWITCHAgent, err))
shtDwn() // stop the engine here

View File

@@ -145,42 +145,6 @@ func TestFreeSwitchAgentReload4(t *testing.T) {
if srv.IsRunning() {
t.Fatalf("Expected service to be down")
}
agentCfg := &config.FsAgentCfg{
Enabled: true,
SessionSConns: nil,
SubscribePark: true,
CreateCDR: true,
ExtraFields: nil,
LowBalanceAnnFile: "",
EmptyBalanceContext: "",
EmptyBalanceAnnFile: "",
MaxWaitConnection: 0,
EventSocketConns: []*config.FsConnCfg{
{
Address: "",
Password: "",
Reconnects: 0,
Alias: "",
},
},
}
srv.(*FreeswitchAgent).fS = agents.NewFSsessions(agentCfg, "", nil)
err := srv.(*FreeswitchAgent).connect(srv.(*FreeswitchAgent).fS, func() {})
if err != nil {
t.Fatalf("\nExpected <%+v>, \nReceived <%+v>", nil, err)
}
}
func TestFreeSwitchAgentReload5(t *testing.T) {
cfg := config.NewDefaultCGRConfig()
cfg.SessionSCfg().Enabled = true
filterSChan := make(chan *engine.FilterS, 1)
filterSChan <- nil
srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)}
srv := NewFreeswitchAgent(cfg, nil, srvDep)
if srv.IsRunning() {
t.Fatalf("Expected service to be down")
}
srv.(*FreeswitchAgent).fS = nil
ctx, cancel := context.WithCancel(context.TODO())