Code Review
/
ric-plt
/
lib
/
rmr.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Correct potenital locking issue in msg allocation
[ric-plt/lib/rmr.git]
/
test
/
app_test
/
caller.c
diff --git
a/test/app_test/caller.c
b/test/app_test/caller.c
index
7b7336a
..
8f93603
100644
(file)
--- a/
test/app_test/caller.c
+++ b/
test/app_test/caller.c
@@
-64,6
+64,7
@@
#include <rmr/rmr.h>
#define TRACE_SIZE 40 // bytes in header to provide for trace junk
#include <rmr/rmr.h>
#define TRACE_SIZE 40 // bytes in header to provide for trace junk
+#define WBUF_SIZE 1024
/*
Thread data
/*
Thread data
@@
-108,13
+109,15
@@
static void* mk_calls( void* data ) {
int drops = 0;
int fail_count = 0; // # of failure sends after first successful send
int successful = 0; // set to true after we have a successful send
int drops = 0;
int fail_count = 0; // # of failure sends after first successful send
int successful = 0; // set to true after we have a successful send
- char
wbuf[1024]
;
+ char
* wbuf = NULL
;
char xbuf[1024]; // build transaction string here
char trace[1024];
int xaction_id = 1;
char* tok;
int state = 0;
char xbuf[1024]; // build transaction string here
char trace[1024];
int xaction_id = 1;
char* tok;
int state = 0;
+ wbuf = (char *) malloc( sizeof( char ) * WBUF_SIZE );
+
if( (control = (tdata_t *) data) == NULL ) {
fprintf( stderr, "thread data was nil; bailing out\n" );
}
if( (control = (tdata_t *) data) == NULL ) {
fprintf( stderr, "thread data was nil; bailing out\n" );
}
@@
-141,7
+144,7
@@
static void* mk_calls( void* data ) {
rt_count++;
}
while( sbuf != NULL && sbuf->state == RMR_ERR_RETRY ) { // send blocked; keep trying
rt_count++;
}
while( sbuf != NULL && sbuf->state == RMR_ERR_RETRY ) { // send blocked; keep trying
- sbuf = rmr_mt_call( control->mrc, sbuf, control->id,
100 ); // call and wait up to 100m
s for a response
+ sbuf = rmr_mt_call( control->mrc, sbuf, control->id,
5000 ); // call and wait up to 5
s for a response
}
if( sbuf != NULL ) {
}
if( sbuf != NULL ) {
@@
-163,7
+166,7
@@
static void* mk_calls( void* data ) {
break;
default:
break;
default:
- fprintf( stderr, "unexpected error: tid=%d rmr-state=%d ernro=%d\n", control->id, sbuf->state, errno );
+ fprintf( stderr, "
<CALLR>
unexpected error: tid=%d rmr-state=%d ernro=%d\n", control->id, sbuf->state, errno );
sbuf = rmr_alloc_msg( control->mrc, 512 ); // allocate a sendable buffer
if( successful ) {
fail_count++; // count failures after first successful message
sbuf = rmr_alloc_msg( control->mrc, 512 ); // allocate a sendable buffer
if( successful ) {
fail_count++; // count failures after first successful message