Adding new comments for Oran in all files with licenses
[ric-plt/e2mgr.git] / E2Manager / rmrCgo / rmrCgoApi.go
index 2de57d9..d7d0870 100644 (file)
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 // See the License for the specific language governing permissions and
 // limitations under the License.
-//
+
+//  This source code is part of the near-RT RIC (RAN Intelligent Controller)
+//  platform project (RICP).
+
 
 package rmrCgo
 
@@ -46,19 +49,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 +79,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)
        }