The change to fix a bug2
[ric-plt/lib/rmr.git] / src / rmr / nng / src / mt_call_nng_static.c
index 2ef21f6..71106f1 100644 (file)
 #include <semaphore.h>
 
 static inline void queue_normal( uta_ctx_t* ctx, rmr_mbuf_t* mbuf ) {
+       static  int warned = 0;
        chute_t*        chute;
-       int                     state;
 
        if( ! uta_ring_insert( ctx->mring, mbuf ) ) {
                rmr_free_msg( mbuf );                                                           // drop if ring is full
+               if( !warned ) {
+                       fprintf( stderr, "[WARN] rmr_mt_receive: application is not receiving fast enough; messages dropping\n" );
+                       warned++;
+               }
+
+               return;
        }
 
        chute = &ctx->chutes[0];
-       chute->mbuf = mbuf;
-       state = sem_post( &chute->barrier );                                                            // tickle the ring monitor
+       sem_post( &chute->barrier );                                                            // tickle the ring monitor
 }
 
 /*
@@ -91,13 +96,8 @@ static void* mt_receive( void* vctx ) {
                                                queue_normal( ctx, mbuf );
                                        } else {
                                                chute = &ctx->chutes[call_id];
-                                               if( memcmp( mbuf->xaction, chute->expect, RMR_MAX_XID ) == 0 ) {                // match
-                                                       chute->mbuf = mbuf;
-                                                       sem_post( &chute->barrier );
-                                               } else {
-                                                       rmr_free_msg( mbuf );
-                                                       mbuf = NULL;
-                                               }
+                                               chute->mbuf = mbuf;
+                                               sem_post( &chute->barrier );                            // the call function can vet xaction id in their own thread
                                        }
                                }
                        }