X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=E2Manager%2FrmrCgo%2FrmrCgoApi.go;h=f2ee54560e1f82170b796a8010268f343431fb06;hb=refs%2Fchanges%2F25%2F1525%2F1;hp=2de57d9d871ef7b273807c55f7ac2cf4644f4e33;hpb=07ef76dd471a0892a893c90e0ab06713aee34be1;p=ric-plt%2Fe2mgr.git diff --git a/E2Manager/rmrCgo/rmrCgoApi.go b/E2Manager/rmrCgo/rmrCgoApi.go index 2de57d9..f2ee545 100644 --- a/E2Manager/rmrCgo/rmrCgoApi.go +++ b/E2Manager/rmrCgo/rmrCgoApi.go @@ -46,19 +46,22 @@ func (*Context) Init(port string, maxMsgSize int, flags int, logger *logger.Logg } } logger.Infof("#rmrCgoApi.Init - RMR router has been initiated") + + // Configure the rmr to make rounds of attempts to send a message before notifying the application that it should retry. + // Each round is about 1000 attempts with a short sleep between each round. + C.rmr_set_stimeout(ctx.RmrCtx, C.int(1000)) r := RmrMessenger(ctx) return &r } -func (ctx *Context) SendMsg(msg *MBuf, maxMsgSize int) (*MBuf, error) { +func (ctx *Context) SendMsg(msg *MBuf) (*MBuf, error) { ctx.checkContextInitialized() ctx.Logger.Debugf("#rmrCgoApi.SendMsg - Going to send message. MBuf: %v", *msg) - allocatedCMBuf := ctx.getAllocatedCRmrMBuf(ctx.Logger, msg, maxMsgSize) + allocatedCMBuf := ctx.getAllocatedCRmrMBuf(ctx.Logger, msg, ctx.MaxMsgSize) defer C.rmr_free_msg(allocatedCMBuf) state := allocatedCMBuf.state if state != RMR_OK { errorMessage := fmt.Sprintf("#rmrCgoApi.SendMsg - Failed to get allocated message. state: %v - %s", state, states[int(state)]) - ctx.Logger.Errorf(errorMessage) return nil, errors.New(errorMessage) } @@ -73,7 +76,6 @@ func (ctx *Context) SendMsg(msg *MBuf, maxMsgSize int) (*MBuf, error) { if state != RMR_OK { errorMessage := fmt.Sprintf("#rmrCgoApi.SendMsg - Failed to send message. state: %v - %s", state, states[int(state)]) - ctx.Logger.Errorf(errorMessage) return nil, errors.New(errorMessage) }