X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Frmr%2Fnng%2Fsrc%2Frmr_nng.c;h=45b7fc6edcb02e88956347af5874becde3861aa3;hb=cf4413c47ce274d7fc08c3bcfc8c4de3d465ad4d;hp=8d55b441100bfa21f735e3fcbae660f334709dda;hpb=8633a0b93e26b619a367de0614437ef2eb4a0b37;p=ric-plt%2Flib%2Frmr.git diff --git a/src/rmr/nng/src/rmr_nng.c b/src/rmr/nng/src/rmr_nng.c index 8d55b44..45b7fc6 100644 --- a/src/rmr/nng/src/rmr_nng.c +++ b/src/rmr/nng/src/rmr_nng.c @@ -753,9 +753,12 @@ static void* init( char* uproto_port, int max_msg_size, int flags ) { return NULL; } + ctx->rtable = rt_clone_space( NULL, NULL, 0 ); // allows wormhole and rts calls to work before rt is received if( flags & FL_NOTHREAD ) { // if no rtc thread, we still need an empty route table for wormholes - ctx->rtable = rt_clone_space( NULL, NULL, 0 ); // so create one + ctx->rmr_ready = 1; // for a nothread instance, rmr is ready to go here } else { + ctx->rmr_ready = o; // ensure not ready until static/dynamic table loaded + if( (tok = getenv( ENV_RTG_RAW )) != NULL && *tok == '0' ) { // use RMR for Rmgr comm only when specifically off if( pthread_create( &ctx->rtc_th, NULL, rtc, (void *) ctx ) ) { // kick the rmr based rt collector thread rmr_vlog( RMR_VL_WARN, "rmr_init: unable to start route table collector thread: %s", strerror( errno ) ); @@ -830,11 +833,7 @@ extern int rmr_ready( void* vctx ) { return FALSE; } - if( ctx->rtable != NULL ) { - return TRUE; - } - - return FALSE; + return ctx->rmr_ready; } /* @@ -1054,7 +1053,7 @@ static rmr_mbuf_t* mt_call( void* vctx, rmr_mbuf_t* mbuf, int call_id, int max_w seconds = 1; // use as flag later to invoked timed wait } - if( ep != NULL ) { + if( ep == NULL ) { mbuf = mtosend_msg( ctx, mbuf, 0 ); // use internal function so as not to strip call-id; should be nil on success! } else { mbuf = send_msg( ctx, mbuf, ep->nn_sock, -1 );