DiameterAgent config max_active_requests -> concurrent_requests renaming

This commit is contained in:
DanB
2019-08-11 15:07:33 +02:00
parent de26355bbf
commit b2c9e8290e
6 changed files with 13 additions and 13 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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))
}
}

View File

@@ -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)

View File

@@ -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

View File

@@ -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