Fix panic with configurations with multiple event socket connections

This commit is contained in:
Hristo Trendev
2020-07-09 21:28:38 +02:00
parent ed6886fcb3
commit ea264a2dd1
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

@@ -297,11 +297,11 @@ func (fsa *FSsessions) Connect() error {
}
fsa.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 := fsa.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, fsa.cfg.MaxWaitConnection,
make(map[string][]func(string, int)), make(map[string][]string), utils.Logger.GetSyslog(), connIdx)
if err != nil {