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
Add additional env variable dump during init
[ric-plt/lib/rmr.git]
/
src
/
rmr
/
si
/
src
/
sr_si_static.c
diff --git
a/src/rmr/si/src/sr_si_static.c
b/src/rmr/si/src/sr_si_static.c
index
3919621
..
28fb69c
100644
(file)
--- a/
src/rmr/si/src/sr_si_static.c
+++ b/
src/rmr/si/src/sr_si_static.c
@@
-39,13
+39,13
@@
static void dump_n( char *p, char* label, int n ) {
if( label ) {
if( label ) {
- fprintf( stderr, "
>>>>>
%s p=%p %d bytes\n", label, p, n );
+ fprintf( stderr, "
[DUMP]
%s p=%p %d bytes\n", label, p, n );
}
rows = (n/16) + ((n % 16) ? 1 : 0);
for( j = 0; j < rows; j++ ) {
}
rows = (n/16) + ((n % 16) ? 1 : 0);
for( j = 0; j < rows; j++ ) {
- fprintf( stderr, "%04x: ", j * 16 );
+ fprintf( stderr, "
[DUMP]
%04x: ", j * 16 );
for( i = 0; t < n && i < 16; i++, t++ ) {
fprintf( stderr, "%02x ", (unsigned char) *p );
for( i = 0; t < n && i < 16; i++, t++ ) {
fprintf( stderr, "%02x ", (unsigned char) *p );
@@
-126,6
+126,7
@@
static inline void insert_mlen( uint32_t len, char* buf ) {
blen++;
*blen = htonl( len ); // new systems want a converted integer
blen++;
*blen = htonl( len ); // new systems want a converted integer
+ memset( &buf[TP_SZFIELD_LEN], 0, 4 ); // clear to prevent future conversion issues
buf[TP_SZFIELD_LEN-1] = TP_SZ_MARKER; // marker to flag this is generated by a new message
}
buf[TP_SZFIELD_LEN-1] = TP_SZ_MARKER; // marker to flag this is generated by a new message
}
@@
-351,7
+352,8
@@
static inline rmr_mbuf_t* clone_msg( rmr_mbuf_t* old_msg ) {
v1hdr = (uta_v1mhdr_t *) old_msg->header; // v1 will work to dig header out of any version
switch( ntohl( v1hdr->rmr_ver ) ) {
case 1:
v1hdr = (uta_v1mhdr_t *) old_msg->header; // v1 will work to dig header out of any version
switch( ntohl( v1hdr->rmr_ver ) ) {
case 1:
- memcpy( v1hdr, old_msg->header, sizeof( *v1hdr ) ); // copy complete header
+ hdr = nm->header;
+ memcpy( hdr, old_msg->header, sizeof( *v1hdr ) ); // copy complete header
nm->payload = (void *) v1hdr + sizeof( *v1hdr );
break;
nm->payload = (void *) v1hdr + sizeof( *v1hdr );
break;
@@
-552,11
+554,11
@@
static inline rmr_mbuf_t* realloc_payload( rmr_mbuf_t* old_msg, int payload_len,
SET_HDR_LEN( nm->header );
if( copy ) { // if we need to copy the old payload too
SET_HDR_LEN( nm->header );
if( copy ) { // if we need to copy the old payload too
- if( DEBUG ) rmr_vlog( RMR_VL_DEBUG, "rmr_realloc_payload: copy payload into new message: %d bytes\n", old_psize );
memcpy( nm->header, omhdr, sizeof( char ) * (old_psize + RMR_HDR_LEN( omhdr )) );
memcpy( nm->header, omhdr, sizeof( char ) * (old_psize + RMR_HDR_LEN( omhdr )) );
+ if( DEBUG ) rmr_vlog( RMR_VL_DEBUG, "rmr_realloc_payload: copy payload into new message: %d bytes\n", old_psize );
} else { // just need to copy header
} else { // just need to copy header
- if( DEBUG ) rmr_vlog( RMR_VL_DEBUG, "rmr_realloc_payload: copy only header into new message: %d bytes\n", RMR_HDR_LEN( nm->header ) );
memcpy( nm->header, omhdr, sizeof( char ) * RMR_HDR_LEN( omhdr ) );
memcpy( nm->header, omhdr, sizeof( char ) * RMR_HDR_LEN( omhdr ) );
+ if( DEBUG ) rmr_vlog( RMR_VL_DEBUG, "rmr_realloc_payload: copy only header into new message: %d bytes\n", RMR_HDR_LEN( nm->header ) );
}
ref_tpbuf( nm, mlen ); // set payload and other pointers in the message to the new tp buffer
}
ref_tpbuf( nm, mlen ); // set payload and other pointers in the message to the new tp buffer
@@
-789,6
+791,7
@@
static rmr_mbuf_t* mtosend_msg( void* vctx, rmr_mbuf_t* msg, int max_to ) {
} else {
ok_sends++;
msg = clone_m; // clone will be the next to send
} else {
ok_sends++;
msg = clone_m; // clone will be the next to send
+ msg->state = RMR_OK;
}
} else {
msg = send_msg( ctx, msg, nn_sock, max_to ); // send the last, and allocate a new buffer; drops the clone if it was
}
} else {
msg = send_msg( ctx, msg, nn_sock, max_to ); // send the last, and allocate a new buffer; drops the clone if it was