Fix panic with configurations with multiple event socket connections

This commit is contained in:
Hristo Trendev
2020-07-09 21:16:35 +02:00
committed by Dan Christian Bogos
parent db68fd7598
commit 9ccec44b95
2 changed files with 4 additions and 3 deletions

View File

@@ -76,6 +76,7 @@ information, please see the [`CONTRIBUTING.md`](CONTRIBUTING.md) file.
| @JDLK7 | Jose Domenech |
| @mintos5 | Michal Škuta |
| @playingbogart | Eugene Bozhet |
| @htrendev | Hristo Trendev |
<!-- to sign, include a single line above this comment containing the following text:
| @username | First Last |

View File

@@ -296,11 +296,11 @@ func (sm *FSsessions) Connect() error {
}
sm.conns[connIdx] = fSock
utils.Logger.Info(fmt.Sprintf("<%s> successfully connected to FreeSWITCH at: <%s>", utils.FreeSWITCHAgent, connCfg.Address))
go func() { // Start reading in own goroutine, return on error
if err := sm.conns[connIdx].ReadEvents(); err != nil {
go func(fsock *fsock.FSock) { // Start reading in own goroutine, return on error
if err := fsock.ReadEvents(); err != nil {
errChan <- err
}
}()
}(fSock)
fsSenderPool, err := fsock.NewFSockPool(5, connCfg.Address, connCfg.Password, 1, sm.cfg.MaxWaitConnection,
make(map[string][]func(string, int)), make(map[string][]string), utils.Logger.GetSyslog(), connIdx)
if err != nil {