summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
c1aee2b)
The timeout specification was millisecond for all but one
place in the nanomsg code. All references are now ms.
Change-Id: I10aa4a5a51c2d9169d43cb2aa4ff7b709974b067
Signed-off-by: E. Scott Daniels <daniels@research.att.com>
int trace_data_len; // len of tracing data that sits just past header (0 means none)
int d1_len; // lengths for additional post header, pre payload data areas
int d2_len;
int trace_data_len; // len of tracing data that sits just past header (0 means none)
int d1_len; // lengths for additional post header, pre payload data areas
int d2_len;
+ int last_rto; // last receive timeout set so that we don't bash in on every call
route_table_t* rtable; // the active route table
route_table_t* old_rtable; // the previously used rt, sits here to allow for draining
route_table_t* new_rtable; // route table under construction
route_table_t* rtable; // the active route table
route_table_t* old_rtable; // the previously used rt, sits here to allow for draining
route_table_t* new_rtable; // route table under construction
// --------------- public functions --------------------------------------------------------------------------
/*
// --------------- public functions --------------------------------------------------------------------------
/*
- Set the receive timeout to time. If time >1000 we assume the time is milliseconds,
- else we assume seconds. Setting -1 is always block.
+ Set the receive timeout to time (ms). A value of 0 is the same as a non-blocking
+ receive and -1 is block for ever.
Returns the nn value (0 on success <0 on error).
*/
extern int rmr_set_rtimeout( void* vctx, int time ) {
Returns the nn value (0 on success <0 on error).
*/
extern int rmr_set_rtimeout( void* vctx, int time ) {
- if( time > 0 ) {
- if( time < 1000 ) {
- time = time * 1000; // assume seconds, nn wants ms
- }
- }
+ if( ctx->last_rto == time ) {
+ return 0;
+ }
+
+ ctx->last_rto = time;
return nn_setsockopt( ctx->nn_sock, NN_SOL_SOCKET, NN_RCVTIMEO, &time, sizeof( time ) );
}
return nn_setsockopt( ctx->nn_sock, NN_SOL_SOCKET, NN_RCVTIMEO, &time, sizeof( time ) );
}
return rmr_rcv_to( vctx, time );
}
return rmr_rcv_to( vctx, time );
}
/*
Set the send timeout to time. If time >1000 we assume the time is milliseconds,
else we assume seconds. Setting -1 is always block.
/*
Set the send timeout to time. If time >1000 we assume the time is milliseconds,
else we assume seconds. Setting -1 is always block.
nanomsg as it just sets the rcv timeout and calls rmr_rcv_msg().
*/
extern rmr_mbuf_t* rmr_torcv_msg( void* vctx, rmr_mbuf_t* old_msg, int ms_to ) {
nanomsg as it just sets the rcv timeout and calls rmr_rcv_msg().
*/
extern rmr_mbuf_t* rmr_torcv_msg( void* vctx, rmr_mbuf_t* old_msg, int ms_to ) {
- rmr_set_rtimeout( vctx, ms_to );
+ uta_ctx_t* ctx;
+
+ if( (ctx = (uta_ctx_t *) vctx) != NULL ) {
+ if( ctx->last_rto != ms_to ) { // avoid call overhead
+ rmr_set_rtimeout( vctx, ms_to );
+ }
+ }
+
return rmr_rcv_msg( vctx, old_msg );
}
return rmr_rcv_msg( vctx, old_msg );
}
ctx->mring = uta_mk_ring( 128 ); // message ring to hold asynch msgs received while waiting for call response
ctx->mring = uta_mk_ring( 128 ); // message ring to hold asynch msgs received while waiting for call response
+ ctx->last_rto = -2; // last receive timeout that was set; invalid value to force first to set
ctx->max_plen = RMR_MAX_RCV_BYTES + sizeof( uta_mhdr_t ); // default max buffer size
if( max_msg_size > 0 ) {
ctx->max_plen = RMR_MAX_RCV_BYTES + sizeof( uta_mhdr_t ); // default max buffer size
if( max_msg_size > 0 ) {