From bdc8064834f112b9843863aec18b13fd84fbff46 Mon Sep 17 00:00:00 2001 From: DanB Date: Wed, 31 Oct 2018 09:29:57 +0100 Subject: [PATCH] Small optimization on diameter answer generation --- agents/diamagent.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/agents/diamagent.go b/agents/diamagent.go index adac5386f..9e32bd9af 100644 --- a/agents/diamagent.go +++ b/agents/diamagent.go @@ -164,8 +164,10 @@ func (da *DiameterAgent) handleMessage(c diam.Conn, m *diam.Message) { } // find out the first itm which is not an attribute var itm *config.NMItem - for i, cfgItm := range nmItms { - if cfgItm.Config == nil || cfgItm.Config.AttributeID == "" { + if len(nmItms) == 1 { + itm = nmItms[0] + } else { // only for groups + for i, cfgItm := range nmItms { itmPath := strings.Join(cfgItm.Path, utils.NestingSep) if i == 0 { // path is common, increase it only once pathIdx[itmPath] += 1