diff --git a/agents/diamagent.go b/agents/diamagent.go index e6c1532f4..640692941 100644 --- a/agents/diamagent.go +++ b/agents/diamagent.go @@ -183,12 +183,12 @@ func (da *DiameterAgent) handleMessage(c diam.Conn, m *diam.Message) { nil, true, utils.NonTransactional) } // handle MaxActiveReqs - if da.cgrCfg.DiameterAgentCfg().MaxActiveReqs != -1 { + if da.cgrCfg.DiameterAgentCfg().ConcurrentReqs != -1 { da.aReqsLck.Lock() - if da.aReqs == da.cgrCfg.DiameterAgentCfg().MaxActiveReqs { + if da.aReqs == da.cgrCfg.DiameterAgentCfg().ConcurrentReqs { utils.Logger.Err( fmt.Sprintf("<%s> denying request due to maximum active requests reached: %d, message: %s", - utils.DiameterAgent, da.cgrCfg.DiameterAgentCfg().MaxActiveReqs, m)) + utils.DiameterAgent, da.cgrCfg.DiameterAgentCfg().ConcurrentReqs, m)) writeOnConn(c, diamErr) da.aReqsLck.Unlock() return diff --git a/config/config_defaults.go b/config/config_defaults.go index 485af39d3..d6719a505 100755 --- a/config/config_defaults.go +++ b/config/config_defaults.go @@ -377,7 +377,7 @@ const CGRATES_CFG_JSON = ` "origin_realm": "cgrates.org", // diameter Origin-Realm AVP used in replies "vendor_id": 0, // diameter Vendor-Id AVP used in replies "product_name": "CGRateS", // diameter Product-Name AVP used in replies - "max_active_requests": -1, // limit the number of active requests processed by the server <-1|0-n> + "concurrent_requests": -1, // limit the number of active requests processed by the server <-1|0-n> "synced_conn_requests": false, // process one request at the time per connection "asr_template": "", // enable AbortSession message being sent to client on DisconnectSession "templates":{ // default message templates diff --git a/config/config_json_test.go b/config/config_json_test.go index 6b967a0b0..a45db42c6 100755 --- a/config/config_json_test.go +++ b/config/config_json_test.go @@ -594,7 +594,7 @@ func TestDiameterAgentJsonCfg(t *testing.T) { Origin_realm: utils.StringPointer("cgrates.org"), Vendor_id: utils.IntPointer(0), Product_name: utils.StringPointer("CGRateS"), - Max_active_requests: utils.IntPointer(-1), + Concurrent_requests: utils.IntPointer(-1), Synced_conn_requests: utils.BoolPointer(false), Asr_template: utils.StringPointer(""), Templates: map[string][]*FcTemplateJsonCfg{ @@ -698,7 +698,7 @@ func TestDiameterAgentJsonCfg(t *testing.T) { if cfg, err := dfCgrJsonCfg.DiameterAgentJsonCfg(); err != nil { t.Error(err) } else if !reflect.DeepEqual(eCfg, cfg) { - t.Errorf("expecting: %s, \n\nreceived: %s", utils.ToJSON(eCfg), utils.ToJSON(cfg)) + t.Errorf("expecting: %s, \n\nreceived: %s", utils.ToIJSON(eCfg), utils.ToIJSON(cfg)) } } diff --git a/config/config_test.go b/config/config_test.go index f4219b303..24237671f 100755 --- a/config/config_test.go +++ b/config/config_test.go @@ -879,7 +879,7 @@ func TestCgrCfgJSONDefaultsDiameterAgentCfg(t *testing.T) { OriginRealm: "cgrates.org", VendorId: 0, ProductName: "CGRateS", - MaxActiveReqs: -1, + ConcurrentReqs: -1, RequestProcessors: nil, } @@ -907,8 +907,8 @@ func TestCgrCfgJSONDefaultsDiameterAgentCfg(t *testing.T) { if !reflect.DeepEqual(cgrCfg.diameterAgentCfg.ProductName, testDA.ProductName) { t.Errorf("received: %+v, expecting: %+v", cgrCfg.diameterAgentCfg.ProductName, testDA.ProductName) } - if !reflect.DeepEqual(cgrCfg.diameterAgentCfg.MaxActiveReqs, testDA.MaxActiveReqs) { - t.Errorf("received: %+v, expecting: %+v", cgrCfg.diameterAgentCfg.MaxActiveReqs, testDA.MaxActiveReqs) + if !reflect.DeepEqual(cgrCfg.diameterAgentCfg.ConcurrentReqs, testDA.ConcurrentReqs) { + t.Errorf("received: %+v, expecting: %+v", cgrCfg.diameterAgentCfg.ConcurrentReqs, testDA.ConcurrentReqs) } if !reflect.DeepEqual(cgrCfg.diameterAgentCfg.RequestProcessors, testDA.RequestProcessors) { t.Errorf("expecting: %+v, received: %+v", testDA.RequestProcessors, cgrCfg.diameterAgentCfg.RequestProcessors) diff --git a/config/diametercfg.go b/config/diametercfg.go index cb04a468a..4ac84d380 100644 --- a/config/diametercfg.go +++ b/config/diametercfg.go @@ -28,7 +28,7 @@ type DiameterAgentCfg struct { OriginRealm string VendorId int ProductName string - MaxActiveReqs int // limit the maximum number of requests processed + ConcurrentReqs int // limit the maximum number of requests processed SyncedConnReqs bool ASRTemplate string Templates map[string][]*FCTemplate @@ -70,8 +70,8 @@ func (da *DiameterAgentCfg) loadFromJsonCfg(jsnCfg *DiameterAgentJsonCfg, separa if jsnCfg.Product_name != nil { da.ProductName = *jsnCfg.Product_name } - if jsnCfg.Max_active_requests != nil { - da.MaxActiveReqs = *jsnCfg.Max_active_requests + if jsnCfg.Concurrent_requests != nil { + da.ConcurrentReqs = *jsnCfg.Concurrent_requests } if jsnCfg.Synced_conn_requests != nil { da.SyncedConnReqs = *jsnCfg.Synced_conn_requests diff --git a/config/libconfig_json.go b/config/libconfig_json.go index 92c1af23d..dadceb3b7 100755 --- a/config/libconfig_json.go +++ b/config/libconfig_json.go @@ -299,7 +299,7 @@ type DiameterAgentJsonCfg struct { Origin_realm *string Vendor_id *int Product_name *string - Max_active_requests *int + Concurrent_requests *int Synced_conn_requests *bool Asr_template *string Templates map[string][]*FcTemplateJsonCfg