DiameterAgent - handle each request into own goroutine, fixes #1447, thanks @chrisgis333

This commit is contained in:
DanB
2019-03-07 09:58:37 +01:00
parent c6ede2898e
commit f296a171e8

View File

@@ -111,7 +111,7 @@ func (da *DiameterAgent) handlers() diam.Handler {
dSM := sm.New(settings)
dSM.HandleFunc("ALL", da.handleMessage) // route all commands to one dispatcher
dSM.HandleFunc("ALL", da.handleMessageAsync) // route all commands to one dispatcher
go func() {
for err := range dSM.ErrorReports() {
utils.Logger.Err(fmt.Sprintf("<%s> sm error: %v", utils.DiameterAgent, err))
@@ -120,6 +120,11 @@ func (da *DiameterAgent) handlers() diam.Handler {
return dSM
}
// handleMessageAsync will dispatch the message into it's own goroutine
func (da *DiameterAgent) handleMessageAsync(c diam.Conn, m *diam.Message) {
go da.handleMessage(c, m)
}
// handleALL is the handler of all messages coming in via Diameter
func (da *DiameterAgent) handleMessage(c diam.Conn, m *diam.Message) {
dApp, err := m.Dictionary().App(m.Header.ApplicationID)