From 116d0f5b6c5b1a396fed835c714a5d568c264cc5 Mon Sep 17 00:00:00 2001 From: "E. Scott Daniels" Date: Mon, 23 Mar 2020 14:37:16 -0400 Subject: [PATCH] Fix msg init bug when pulling msg from the poo2 When reusing a message from the message pool the flags were not being properly reset before the message was returned Issue-ID: RIC-295 Signed-off-by: E. Scott Daniels Change-Id: I5924e162ca9e1835807785e2401a871f1fcd36b2 --- CHANGES_CORE.txt | 4 ++++ CMakeLists.txt | 2 +- src/rmr/si/src/sr_si_static.c | 8 +++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGES_CORE.txt b/CHANGES_CORE.txt index 33e2670..227f92b 100644 --- a/CHANGES_CORE.txt +++ b/CHANGES_CORE.txt @@ -5,6 +5,10 @@ # API and build change and fix summaries. Doc correctsions # and/or changes are not mentioned here; see the commit messages. +2020 March 23; version 3.6.2 + Fix message initialisation bug when pulling a message from + the pool (RIC-295) + 2020 March 19; version 3.6.1 Fix problem with RPM package install diff --git a/CMakeLists.txt b/CMakeLists.txt index 141fb18..ae986c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,7 @@ cmake_minimum_required( VERSION 3.5 ) set( major_version "3" ) # should be automatically populated from git tag later, but until CI process sets a tag we use this set( minor_version "6" ) -set( patch_level "1" ) +set( patch_level "2" ) set( install_root "${CMAKE_INSTALL_PREFIX}" ) set( install_inc "include/rmr" ) diff --git a/src/rmr/si/src/sr_si_static.c b/src/rmr/si/src/sr_si_static.c index 50aaeb8..40ae61b 100644 --- a/src/rmr/si/src/sr_si_static.c +++ b/src/rmr/si/src/sr_si_static.c @@ -147,6 +147,7 @@ static rmr_mbuf_t* alloc_zcmsg( uta_ctx_t* ctx, rmr_mbuf_t* msg, int size, int s msg->alloc_len = 0; // force tp_buffer realloc below if( msg->tp_buf ) { free( msg->tp_buf ); + msg->tp_buf = NULL; } } else { mlen = msg->alloc_len; // msg given, allocate the same size as before @@ -160,10 +161,11 @@ static rmr_mbuf_t* alloc_zcmsg( uta_ctx_t* ctx, rmr_mbuf_t* msg, int size, int s abort( ); // toss out a core file for this } -/* +#ifdef DEBUG memset( msg->tp_buf, 0, mlen ); // NOT for production (debug only) valgrind will complain about uninitalised use if we don't set memcpy( msg->tp_buf, "@@!!@@!!@@!!@@!!@@!!@@!!@@!!@@!!**", TP_HDR_LEN ); // NOT for production -- debugging eyecatcher -*/ +#endif + alen = (int *) msg->tp_buf; *alen = mlen; // FIX ME: need a stuct to go in these first bytes, not just dummy len @@ -185,7 +187,7 @@ static rmr_mbuf_t* alloc_zcmsg( uta_ctx_t* ctx, rmr_mbuf_t* msg, int size, int s msg->payload = PAYLOAD_ADDR( hdr ); // point to payload (past all header junk) msg->xaction = ((uta_mhdr_t *)msg->header)->xid; // point at transaction id in header area msg->state = state; // fill in caller's state (likely the state of the last operation) - msg->flags |= MFL_ZEROCOPY; // this is a zerocopy sendable message + msg->flags = MFL_ZEROCOPY; // this is a zerocopy sendable message msg->ring = ctx->zcb_mring; // original msg_free() api doesn't get context so must dup on eaach :( strncpy( (char *) ((uta_mhdr_t *)msg->header)->src, ctx->my_name, RMR_MAX_SRC ); strncpy( (char *) ((uta_mhdr_t *)msg->header)->srcip, ctx->my_ip, RMR_MAX_SRC ); -- 2.16.6