From bb9c5400eba1b31b04e40421d3dae06392027421 Mon Sep 17 00:00:00 2001 From: TeoV Date: Tue, 6 Mar 2018 08:13:41 -0500 Subject: [PATCH] Rename in session ProcessThreshold -> ProcessThresholds --- agents/fsevent.go | 6 +++--- agents/kamevent.go | 8 ++++---- sessions/sessions.go | 28 +++++++++++++++++----------- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/agents/fsevent.go b/agents/fsevent.go index 765a7fbe1..ee31bda0a 100644 --- a/agents/fsevent.go +++ b/agents/fsevent.go @@ -399,7 +399,7 @@ func (fsev FSEvent) V1AuthorizeArgs() (args *sessions.V1AuthorizeArgs) { args.GetAttributes = true } if strings.Index(subsystems, utils.MetaThresholds) != -1 { - args.ProcessThreshold = utils.BoolPointer(true) + args.ProcessThresholds = utils.BoolPointer(true) } return } @@ -434,7 +434,7 @@ func (fsev FSEvent) V1InitSessionArgs() (args *sessions.V1InitSessionArgs) { args.GetAttributes = true } if strings.Index(subsystems, utils.MetaThresholds) != -1 { - args.ProcessThreshold = utils.BoolPointer(true) + args.ProcessThresholds = utils.BoolPointer(true) } return } @@ -466,7 +466,7 @@ func (fsev FSEvent) V1TerminateSessionArgs() (args *sessions.V1TerminateSessionA args.ReleaseResources = true } if strings.Index(subsystems, utils.MetaThresholds) != -1 { - args.ProcessThreshold = utils.BoolPointer(true) + args.ProcessThresholds = utils.BoolPointer(true) } return } diff --git a/agents/kamevent.go b/agents/kamevent.go index ae08342a7..ed0237245 100644 --- a/agents/kamevent.go +++ b/agents/kamevent.go @@ -245,7 +245,7 @@ func (kev KamEvent) V1AuthorizeArgs() (args *sessions.V1AuthorizeArgs) { args.GetAttributes = true } if strings.Index(subsystems, utils.MetaThresholds) != -1 { - args.ProcessThreshold = utils.BoolPointer(true) + args.ProcessThresholds = utils.BoolPointer(true) } return } @@ -277,7 +277,7 @@ func (kev KamEvent) AsKamAuthReply(authArgs *sessions.V1AuthorizeArgs, if authArgs.GetSuppliers && authReply.Suppliers != nil { kar.Suppliers = authReply.Suppliers.Digest() } - if authArgs.ProcessThreshold != nil && *authArgs.ProcessThreshold { + if authArgs.ProcessThresholds != nil && *authArgs.ProcessThresholds { kar.ThresholdHits = *authReply.ThresholdHits } return @@ -333,7 +333,7 @@ func (kev KamEvent) V1InitSessionArgs() (args *sessions.V1InitSessionArgs) { args.GetAttributes = true } if strings.Index(subsystems, utils.MetaThresholds) != -1 { - args.ProcessThreshold = utils.BoolPointer(true) + args.ProcessThresholds = utils.BoolPointer(true) } return } @@ -385,7 +385,7 @@ func (kev KamEvent) V1TerminateSessionArgs() (args *sessions.V1TerminateSessionA args.ReleaseResources = true } if strings.Index(subsystems, utils.MetaThresholds) != -1 { - args.ProcessThreshold = utils.BoolPointer(true) + args.ProcessThresholds = utils.BoolPointer(true) } return } diff --git a/sessions/sessions.go b/sessions/sessions.go index 42ee72d9d..c0040a1ac 100644 --- a/sessions/sessions.go +++ b/sessions/sessions.go @@ -1295,7 +1295,7 @@ type V1AuthorizeArgs struct { AuthorizeResources bool GetMaxUsage bool GetSuppliers bool - ProcessThreshold *bool + ProcessThresholds *bool utils.CGREvent utils.Paginator } @@ -1329,6 +1329,9 @@ func (v1AuthReply *V1AuthorizeReply) AsCGRReply() (cgrReply utils.CGRReply, err if v1AuthReply.Suppliers != nil { cgrReply["Suppliers"] = v1AuthReply.Suppliers.Digest() } + if v1AuthReply.ThresholdHits != nil { + cgrReply["ThresholdHits"] = *v1AuthReply.ThresholdHits + } return } @@ -1405,8 +1408,8 @@ func (smg *SMGeneric) BiRPCv1AuthorizeEvent(clnt rpcclient.RpcClientConnection, } } checkThresholds := smg.thdS != nil - if args.ProcessThreshold != nil { - checkThresholds = *args.ProcessThreshold + if args.ProcessThresholds != nil { + checkThresholds = *args.ProcessThresholds } if checkThresholds { if smg.thdS == nil { @@ -1464,7 +1467,7 @@ type V1InitSessionArgs struct { GetAttributes bool AllocateResources bool InitSession bool - ProcessThreshold *bool + ProcessThresholds *bool utils.CGREvent } @@ -1493,6 +1496,9 @@ func (v1Rply *V1InitSessionReply) AsCGRReply() (cgrReply utils.CGRReply, err err if v1Rply.MaxUsage != nil { cgrReply["MaxUsage"] = *v1Rply.MaxUsage } + if v1Rply.ThresholdHits != nil { + cgrReply["ThresholdHits"] = *v1Rply.ThresholdHits + } return } @@ -1549,8 +1555,8 @@ func (smg *SMGeneric) BiRPCv1InitiateSession(clnt rpcclient.RpcClientConnection, } } checkThresholds := smg.thdS != nil - if args.ProcessThreshold != nil { - checkThresholds = *args.ProcessThreshold + if args.ProcessThresholds != nil { + checkThresholds = *args.ProcessThresholds } if checkThresholds { if smg.thdS == nil { @@ -1635,9 +1641,9 @@ func (smg *SMGeneric) BiRPCv1UpdateSession(clnt rpcclient.RpcClientConnection, } type V1TerminateSessionArgs struct { - TerminateSession bool - ReleaseResources bool - ProcessThreshold *bool + TerminateSession bool + ReleaseResources bool + ProcessThresholds *bool utils.CGREvent } @@ -1675,8 +1681,8 @@ func (smg *SMGeneric) BiRPCv1TerminateSession(clnt rpcclient.RpcClientConnection } } checkThresholds := smg.thdS != nil - if args.ProcessThreshold != nil { - checkThresholds = *args.ProcessThreshold + if args.ProcessThresholds != nil { + checkThresholds = *args.ProcessThresholds } if checkThresholds { if smg.thdS == nil {