DiameterAgent - Empty the pubsub interface so we can later check it if nil

This commit is contained in:
DanB
2016-09-05 16:28:00 +02:00
parent 3614d17775
commit db4bf4dfbc

View File

@@ -19,6 +19,7 @@ package agents
import (
"fmt"
"reflect"
"strconv"
"strings"
"sync"
@@ -34,6 +35,9 @@ import (
func NewDiameterAgent(cgrCfg *config.CGRConfig, smg rpcclient.RpcClientConnection, pubsubs rpcclient.RpcClientConnection) (*DiameterAgent, error) {
da := &DiameterAgent{cgrCfg: cgrCfg, smg: smg, pubsubs: pubsubs, connMux: new(sync.Mutex)}
if reflect.ValueOf(da.pubsubs).IsNil() {
da.pubsubs = nil // Empty it so we can check it later
}
dictsDir := cgrCfg.DiameterAgentCfg().DictionariesDir
if len(dictsDir) != 0 {
if err := loadDictionaries(dictsDir, "DiameterAgent"); err != nil {