Fix caps error typo

This commit is contained in:
ionutboangiu
2023-02-15 09:20:09 -05:00
committed by Dan Christian Bogos
parent 7c7c701b2c
commit b27ed9f53e
12 changed files with 77 additions and 76 deletions

View File

@@ -411,7 +411,7 @@ func (sma *AsteriskAgent) BiRPCv1WarnDisconnect(clnt rpcclient.ClientConnector,
// BiRPCv1CapsError is used to return error when the caps limit is hit
func (sma *AsteriskAgent) BiRPCv1CapsError(clnt rpcclient.ClientConnector, args interface{}, reply *string) (err error) {
return utils.ErrMaxConcurentRPCExceeded
return utils.ErrMaxConcurrentRPCExceeded
}
// Handlers is used to implement the rpcclient.BiRPCConector interface

View File

@@ -604,7 +604,7 @@ func (da *DiameterAgent) BiRPCv1WarnDisconnect(clnt rpcclient.ClientConnector, a
// BiRPCv1CapsError is used to return error when the caps limit is hit
func (da *DiameterAgent) BiRPCv1CapsError(clnt rpcclient.ClientConnector, args interface{}, reply *string) (err error) {
return utils.ErrMaxConcurentRPCExceeded
return utils.ErrMaxConcurrentRPCExceeded
}
// Handlers is used to implement the rpcclient.BiRPCConector interface

View File

@@ -516,7 +516,7 @@ func (fsa *FSsessions) BiRPCv1WarnDisconnect(clnt rpcclient.ClientConnector, arg
// BiRPCv1CapsError is used to return error when the caps limit is hit
func (fsa *FSsessions) BiRPCv1CapsError(clnt rpcclient.ClientConnector, args interface{}, reply *string) (err error) {
return utils.ErrMaxConcurentRPCExceeded
return utils.ErrMaxConcurrentRPCExceeded
}
// Handlers is used to implement the rpcclient.BiRPCConector interface

View File

@@ -484,7 +484,7 @@ func (ka *KamailioAgent) BiRPCv1WarnDisconnect(clnt rpcclient.ClientConnector, a
// BiRPCv1CapsError is used to return error when the caps limit is hit
func (ka *KamailioAgent) BiRPCv1CapsError(clnt rpcclient.ClientConnector, args interface{}, reply *string) (err error) {
return utils.ErrMaxConcurentRPCExceeded
return utils.ErrMaxConcurrentRPCExceeded
}
// Handlers is used to implement the rpcclient.BiRPCConector interface

View File

@@ -180,7 +180,7 @@ func testCapsOnHTTPBusy(t *testing.T) {
return
}
resp.Body.Close()
if strings.Contains(string(contents), utils.ErrMaxConcurentRPCExceeded.Error()) {
if strings.Contains(string(contents), utils.ErrMaxConcurrentRPCExceeded.Error()) {
lock.Lock()
fldAPIs++
lock.Unlock()
@@ -244,9 +244,9 @@ func testCapsOnBiJSONBusy(t *testing.T) {
for waiting {
select {
case err := <-errChan:
if err.Error() != utils.ErrMaxConcurentRPCExceeded.Error() {
if err.Error() != utils.ErrMaxConcurrentRPCExceeded.Error() {
t.Errorf("expected: <%+v>, \nreceived: <%+v>",
utils.ErrMaxConcurentRPCExceeded, err)
utils.ErrMaxConcurrentRPCExceeded, err)
}
case <-waitCh:
waiting = false

View File

@@ -68,5 +68,5 @@ func (smgv1 *SMGenericV1) BiRPCV1ProcessCDR(clnt *rpc2.Client,
// BiRPCv1CapsError is used to return error when the caps limit is hit
func (smgv1 *SMGenericV1) BiRPCV1CapsError(clnt *rpc2.Client,
args interface{}, reply *string) (err error) {
return utils.ErrMaxConcurentRPCExceeded
return utils.ErrMaxConcurrentRPCExceeded
}

View File

@@ -101,8 +101,8 @@ func (c *capsServerCodec) ReadRequestBody(x interface{}) error {
return c.sc.ReadRequestBody(x)
}
func (c *capsServerCodec) WriteResponse(r *rpc.Response, x interface{}) error {
if r.Error == utils.ErrMaxConcurentRPCExceededNoCaps.Error() {
r.Error = utils.ErrMaxConcurentRPCExceeded.Error()
if r.Error == utils.ErrMaxConcurrentRPCExceededNoCaps.Error() {
r.Error = utils.ErrMaxConcurrentRPCExceeded.Error()
} else {
defer c.caps.Deallocate()
}
@@ -164,7 +164,8 @@ type capsBiRPCCodec struct {
// ReadHeader must read a message and populate either the request
// or the response by inspecting the incoming message.
func (c *capsBiRPCCodec) ReadHeader(req *rpc2.Request, resp *rpc2.Response) (err error) {
if err = c.sc.ReadHeader(req, resp); err != nil || req.Method == utils.EmptyString {
if err = c.sc.ReadHeader(req, resp); err != nil ||
req.Method == utils.EmptyString { // caps will not process replies
return
}
if err = c.caps.Allocate(); err != nil {
@@ -191,8 +192,8 @@ func (c *capsBiRPCCodec) WriteRequest(req *rpc2.Request, x interface{}) error {
// WriteResponse must be safe for concurrent use by multiple goroutines.
func (c *capsBiRPCCodec) WriteResponse(r *rpc2.Response, x interface{}) error {
if r.Error == utils.ErrMaxConcurentRPCExceededNoCaps.Error() {
r.Error = utils.ErrMaxConcurentRPCExceeded.Error()
if r.Error == utils.ErrMaxConcurrentRPCExceededNoCaps.Error() {
r.Error = utils.ErrMaxConcurrentRPCExceeded.Error()
} else {
defer c.caps.Deallocate()
}

View File

@@ -80,8 +80,8 @@ func TestNewCapsServerCodec(t *testing.T) {
t.Fatal(err)
}
if err = codec.ReadRequestBody("args"); err != utils.ErrMaxConcurentRPCExceededNoCaps {
t.Errorf("Expected error: %v ,received: %v ", utils.ErrMaxConcurentRPCExceededNoCaps, err)
if err = codec.ReadRequestBody("args"); err != utils.ErrMaxConcurrentRPCExceededNoCaps {
t.Errorf("Expected error: %v ,received: %v ", utils.ErrMaxConcurrentRPCExceededNoCaps, err)
}
if err = codec.WriteResponse(&rpc.Response{
@@ -93,7 +93,7 @@ func TestNewCapsServerCodec(t *testing.T) {
}
if err = codec.WriteResponse(&rpc.Response{
Error: utils.ErrMaxConcurentRPCExceededNoCaps.Error(),
Error: utils.ErrMaxConcurrentRPCExceededNoCaps.Error(),
Seq: 0,
ServiceMethod: utils.CoreSv1Ping,
}, "reply"); err != nil {
@@ -184,8 +184,8 @@ func TestNewCapsBiRPCCodec(t *testing.T) {
t.Fatal(err)
}
if err = codec.ReadRequestBody("args"); err != utils.ErrMaxConcurentRPCExceededNoCaps {
t.Errorf("Expected error: %v ,received: %v ", utils.ErrMaxConcurentRPCExceededNoCaps, err)
if err = codec.ReadRequestBody("args"); err != utils.ErrMaxConcurrentRPCExceededNoCaps {
t.Errorf("Expected error: %v ,received: %v ", utils.ErrMaxConcurrentRPCExceededNoCaps, err)
}
if err = codec.WriteResponse(&rpc2.Response{
@@ -207,7 +207,7 @@ func TestNewCapsBiRPCCodec(t *testing.T) {
}
if err = codec.WriteResponse(&rpc2.Response{
Error: utils.ErrMaxConcurentRPCExceededNoCaps.Error(),
Error: utils.ErrMaxConcurrentRPCExceededNoCaps.Error(),
Seq: 0,
}, "reply"); err != nil {
t.Fatal(err)

View File

@@ -55,7 +55,7 @@ func (cR *Caps) Allocate() (err error) {
switch cR.strategy {
case utils.MetaBusy:
if len(cR.aReqs) == cap(cR.aReqs) {
return utils.ErrMaxConcurentRPCExceededNoCaps
return utils.ErrMaxConcurrentRPCExceededNoCaps
}
fallthrough
case utils.MetaQueue:

View File

@@ -47,8 +47,8 @@ func TestNewCaps(t *testing.T) {
if al := cs.Allocated(); al != 0 {
t.Errorf("Expected: %v ,received: %v", 0, al)
}
if err := cs.Allocate(); err != utils.ErrMaxConcurentRPCExceededNoCaps {
t.Errorf("Expected: %v ,received: %v", utils.ErrMaxConcurentRPCExceededNoCaps, err)
if err := cs.Allocate(); err != utils.ErrMaxConcurrentRPCExceededNoCaps {
t.Errorf("Expected: %v ,received: %v", utils.ErrMaxConcurrentRPCExceededNoCaps, err)
}
cs = NewCaps(1, utils.MetaBusy)
if err := cs.Allocate(); err != nil {

View File

@@ -4136,7 +4136,7 @@ func (sS *SessionS) BiRPCv1STIRIdentity(clnt rpcclient.ClientConnector,
// BiRPCv1STIRIdentity the API for STIR header creation
func (sS *SessionS) BiRPCv1CapsError(clnt rpcclient.ClientConnector,
args interface{}, identity *string) (err error) {
return utils.ErrMaxConcurentRPCExceeded
return utils.ErrMaxConcurrentRPCExceeded
}
// Handlers bidirectional methods following

View File

@@ -25,59 +25,59 @@ import (
)
var (
ErrNoMoreData = errors.New("NO_MORE_DATA")
ErrNotImplemented = errors.New("NOT_IMPLEMENTED")
ErrNotFound = errors.New("NOT_FOUND")
ErrDSPHostNotFound = errors.New("DSP_HOST_NOT_FOUND")
ErrDSPProfileNotFound = errors.New("DSP_PROFILE_NOT_FOUND")
ErrTimedOut = errors.New("TIMED_OUT")
ErrServerError = errors.New("SERVER_ERROR")
ErrMaxRecursionDepth = errors.New("MAX_RECURSION_DEPTH")
ErrMandatoryIeMissing = errors.New("MANDATORY_IE_MISSING")
ErrExists = errors.New("EXISTS")
ErrBrokenReference = errors.New("BROKEN_REFERENCE")
ErrParserError = errors.New("PARSER_ERROR")
ErrInvalidPath = errors.New("INVALID_PATH")
ErrInvalidKey = errors.New("INVALID_KEY")
ErrUnauthorizedDestination = errors.New("UNAUTHORIZED_DESTINATION")
ErrRatingPlanNotFound = errors.New("RATING_PLAN_NOT_FOUND")
ErrAccountNotFound = errors.New("ACCOUNT_NOT_FOUND")
ErrAccountDisabled = errors.New("ACCOUNT_DISABLED")
ErrInsufficientCredit = errors.New("INSUFFICIENT_CREDIT")
ErrNotConvertible = errors.New("NOT_CONVERTIBLE")
ErrResourceUnavailable = errors.New("RESOURCE_UNAVAILABLE")
ErrResourceUnauthorized = errors.New("RESOURCE_UNAUTHORIZED")
ErrNoActiveSession = errors.New("NO_ACTIVE_SESSION")
ErrPartiallyExecuted = errors.New("PARTIALLY_EXECUTED")
ErrMaxUsageExceeded = errors.New("MAX_USAGE_EXCEEDED")
ErrMaxCostExceeded = errors.New("MAX_COST_EXCEEDED")
ErrFilterNotPassingNoCaps = errors.New("filter not passing")
ErrNotConvertibleNoCaps = errors.New("not convertible")
ErrMandatoryIeMissingNoCaps = errors.New("mandatory information missing")
ErrUnauthorizedApi = errors.New("UNAUTHORIZED_API")
ErrUnknownApiKey = errors.New("UNKNOWN_API_KEY")
ErrReqUnsynchronized = errors.New("REQ_UNSYNCHRONIZED")
ErrUnsupporteServiceMethod = errors.New("UNSUPPORTED_SERVICE_METHOD")
ErrDisconnected = errors.New("DISCONNECTED")
ErrReplyTimeout = errors.New("REPLY_TIMEOUT")
ErrSessionNotFound = errors.New("SESSION_NOT_FOUND")
ErrJsonIncompleteComment = errors.New("JSON_INCOMPLETE_COMMENT")
ErrNotEnoughParameters = errors.New("NotEnoughParameters")
ErrNotConnected = errors.New("NOT_CONNECTED")
RalsErrorPrfx = "RALS_ERROR"
DispatcherErrorPrefix = "DISPATCHER_ERROR"
RateSErrPrfx = "RATES_ERROR"
ErrUnsupportedFormat = errors.New("UNSUPPORTED_FORMAT")
ErrNoDatabaseConn = errors.New("NO_DATABASE_CONNECTION")
ErrMaxIncrementsExceeded = errors.New("MAX_INCREMENTS_EXCEEDED")
ErrIndexOutOfBounds = errors.New("INDEX_OUT_OF_BOUNDS")
ErrWrongPath = errors.New("WRONG_PATH")
ErrServiceAlreadyRunning = fmt.Errorf("service already running")
ErrMaxConcurentRPCExceededNoCaps = errors.New("max concurent rpc exceeded") // on internal we return this error for concureq
ErrMaxConcurentRPCExceeded = errors.New("MAX_CONCURENT_RPC_EXCEEDED") // but the codec will rewrite it with this one to be sure that we corectly dealocate the request
ErrMaxIterationsReached = errors.New("maximum iterations reached")
ErrNegative = errors.New("NEGATIVE")
ErrCastFailed = errors.New("CAST_FAILED")
ErrNoMoreData = errors.New("NO_MORE_DATA")
ErrNotImplemented = errors.New("NOT_IMPLEMENTED")
ErrNotFound = errors.New("NOT_FOUND")
ErrDSPHostNotFound = errors.New("DSP_HOST_NOT_FOUND")
ErrDSPProfileNotFound = errors.New("DSP_PROFILE_NOT_FOUND")
ErrTimedOut = errors.New("TIMED_OUT")
ErrServerError = errors.New("SERVER_ERROR")
ErrMaxRecursionDepth = errors.New("MAX_RECURSION_DEPTH")
ErrMandatoryIeMissing = errors.New("MANDATORY_IE_MISSING")
ErrExists = errors.New("EXISTS")
ErrBrokenReference = errors.New("BROKEN_REFERENCE")
ErrParserError = errors.New("PARSER_ERROR")
ErrInvalidPath = errors.New("INVALID_PATH")
ErrInvalidKey = errors.New("INVALID_KEY")
ErrUnauthorizedDestination = errors.New("UNAUTHORIZED_DESTINATION")
ErrRatingPlanNotFound = errors.New("RATING_PLAN_NOT_FOUND")
ErrAccountNotFound = errors.New("ACCOUNT_NOT_FOUND")
ErrAccountDisabled = errors.New("ACCOUNT_DISABLED")
ErrInsufficientCredit = errors.New("INSUFFICIENT_CREDIT")
ErrNotConvertible = errors.New("NOT_CONVERTIBLE")
ErrResourceUnavailable = errors.New("RESOURCE_UNAVAILABLE")
ErrResourceUnauthorized = errors.New("RESOURCE_UNAUTHORIZED")
ErrNoActiveSession = errors.New("NO_ACTIVE_SESSION")
ErrPartiallyExecuted = errors.New("PARTIALLY_EXECUTED")
ErrMaxUsageExceeded = errors.New("MAX_USAGE_EXCEEDED")
ErrMaxCostExceeded = errors.New("MAX_COST_EXCEEDED")
ErrFilterNotPassingNoCaps = errors.New("filter not passing")
ErrNotConvertibleNoCaps = errors.New("not convertible")
ErrMandatoryIeMissingNoCaps = errors.New("mandatory information missing")
ErrUnauthorizedApi = errors.New("UNAUTHORIZED_API")
ErrUnknownApiKey = errors.New("UNKNOWN_API_KEY")
ErrReqUnsynchronized = errors.New("REQ_UNSYNCHRONIZED")
ErrUnsupporteServiceMethod = errors.New("UNSUPPORTED_SERVICE_METHOD")
ErrDisconnected = errors.New("DISCONNECTED")
ErrReplyTimeout = errors.New("REPLY_TIMEOUT")
ErrSessionNotFound = errors.New("SESSION_NOT_FOUND")
ErrJsonIncompleteComment = errors.New("JSON_INCOMPLETE_COMMENT")
ErrNotEnoughParameters = errors.New("NotEnoughParameters")
ErrNotConnected = errors.New("NOT_CONNECTED")
RalsErrorPrfx = "RALS_ERROR"
DispatcherErrorPrefix = "DISPATCHER_ERROR"
RateSErrPrfx = "RATES_ERROR"
ErrUnsupportedFormat = errors.New("UNSUPPORTED_FORMAT")
ErrNoDatabaseConn = errors.New("NO_DATABASE_CONNECTION")
ErrMaxIncrementsExceeded = errors.New("MAX_INCREMENTS_EXCEEDED")
ErrIndexOutOfBounds = errors.New("INDEX_OUT_OF_BOUNDS")
ErrWrongPath = errors.New("WRONG_PATH")
ErrServiceAlreadyRunning = fmt.Errorf("service already running")
ErrMaxConcurrentRPCExceededNoCaps = errors.New("max concurrent rpc exceeded") // on internal we return this error for concureq
ErrMaxConcurrentRPCExceeded = errors.New("MAX_CONCURRENT_RPC_EXCEEDED") // but the codec will rewrite it with this one to be sure that we corectly dealocate the request
ErrMaxIterationsReached = errors.New("maximum iterations reached")
ErrNegative = errors.New("NEGATIVE")
ErrCastFailed = errors.New("CAST_FAILED")
ErrMap = map[string]error{
ErrNoMoreData.Error(): ErrNoMoreData,