X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=E2Manager%2FrmrCgo%2FrmrCgoApi.go;h=7f686848c1b4369a2f60382da18779162cb80e9d;hb=e4f4427a1dfde7ac6fa5656496627ad88f82a1a6;hp=4a9f8c4fde07b15159384c285898e192259c68b7;hpb=bcb124908ffd1de0c00868838bbac733b881fcb2;p=ric-plt%2Fe2mgr.git diff --git a/E2Manager/rmrCgo/rmrCgoApi.go b/E2Manager/rmrCgo/rmrCgoApi.go index 4a9f8c4..7f68684 100644 --- a/E2Manager/rmrCgo/rmrCgoApi.go +++ b/E2Manager/rmrCgo/rmrCgoApi.go @@ -54,7 +54,7 @@ func (*Context) Init(port string, maxMsgSize int, flags int, logger *logger.Logg return r } -func (ctx *Context) SendMsg(msg *MBuf) (*MBuf, error) { +func (ctx *Context) SendMsg(msg *MBuf, printLogs bool) (*MBuf, error) { ctx.checkContextInitialized() ctx.Logger.Debugf("#rmrCgoApi.SendMsg - Going to send message. MBuf: %v", *msg) allocatedCMBuf := ctx.getAllocatedCRmrMBuf(ctx.Logger, msg, ctx.MaxMsgSize) @@ -65,21 +65,21 @@ func (ctx *Context) SendMsg(msg *MBuf) (*MBuf, error) { return nil, errors.New(errorMessage) } - //TODO: if debug enabled - transactionId := string(*msg.XAction) - tmpTid := strings.TrimSpace(transactionId) - ctx.Logger.Infof("[E2 Manager -> RMR] #rmrCgoApi.SendMsg - Going to send message %v for transaction id: %s", *msg, tmpTid) + if printLogs { + //TODO: if debug enabled + transactionId := string(*msg.XAction) + tmpTid := strings.TrimSpace(transactionId) + ctx.Logger.Infof("[E2 Manager -> RMR] #rmrCgoApi.SendMsg - Going to send message %v for transaction id: %s", *msg, tmpTid) + } currCMBuf := C.rmr_send_msg(ctx.RmrCtx, allocatedCMBuf) state = currCMBuf.state - ctx.Logger.Debugf("#rmrCgoApi.SendMsg - The current message state: %v, message buffer:%v", state, currCMBuf) if state != RMR_OK { errorMessage := fmt.Sprintf("#rmrCgoApi.SendMsg - Failed to send message. state: %v - %s", state, states[int(state)]) return nil, errors.New(errorMessage) } - ctx.Logger.Debugf("#rmrCgoApi.SendMsg - The message has been sent successfully ") return convertToMBuf(ctx.Logger, currCMBuf), nil } @@ -99,9 +99,13 @@ func (ctx *Context) RecvMsg() (*MBuf, error) { } mbuf := convertToMBuf(ctx.Logger, currCMBuf) - transactionId := string(*mbuf.XAction) - tmpTid := strings.TrimSpace(transactionId) - ctx.Logger.Infof("[RMR -> E2 Manager] #rmrCgoApi.RecvMsg - message %v has been received for transaction id: %s", *mbuf, tmpTid) + + if mbuf.MType != E2_TERM_KEEP_ALIVE_RESP { + + transactionId := string(*mbuf.XAction) + tmpTid := strings.TrimSpace(transactionId) + ctx.Logger.Infof("[RMR -> E2 Manager] #rmrCgoApi.RecvMsg - message %v has been received for transaction id: %s", *mbuf, tmpTid) + } return mbuf, nil }