Increased resolution of PDU timeout from seconds to milliseconds
parent
70197d5ab8
commit
fb1efbe51c
|
@ -175,7 +175,7 @@ struct rpc_pdu {
|
|||
#define PDU_DISCARD_AFTER_SENDING 0x00000001
|
||||
uint32_t flags;
|
||||
|
||||
time_t timeout;
|
||||
long timeout;
|
||||
};
|
||||
|
||||
void rpc_reset_queue(struct rpc_queue *q);
|
||||
|
@ -233,7 +233,7 @@ int rpc_get_timeout(struct rpc_context *rpc);
|
|||
int rpc_add_fragment(struct rpc_context *rpc, char *data, uint32_t size);
|
||||
void rpc_free_all_fragments(struct rpc_context *rpc);
|
||||
int rpc_is_udp_socket(struct rpc_context *rpc);
|
||||
int rpc_current_time(void);
|
||||
long rpc_current_time(void);
|
||||
|
||||
void *zdr_malloc(ZDR *zdrs, uint32_t size);
|
||||
|
||||
|
|
|
@ -50,15 +50,15 @@
|
|||
#include "libnfs-raw.h"
|
||||
#include "libnfs-private.h"
|
||||
|
||||
int rpc_current_time(void)
|
||||
long rpc_current_time(void)
|
||||
{
|
||||
#ifdef HAVE_CLOCK_GETTIME
|
||||
struct timespec tp;
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC_COARSE, &tp);
|
||||
return tp.tv_sec;
|
||||
return tp.tv_sec * 1000 + tp.tv_nsec / 1000000;
|
||||
#else
|
||||
return time(NULL);
|
||||
return (long) time(NULL) * 1000;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ int rpc_queue_pdu(struct rpc_context *rpc, struct rpc_pdu *pdu)
|
|||
assert(rpc->magic == RPC_CONTEXT_MAGIC);
|
||||
|
||||
if (rpc->timeout > 0) {
|
||||
pdu->timeout = rpc_current_time() + rpc->timeout / 1000;
|
||||
pdu->timeout = rpc_current_time() + rpc->timeout;
|
||||
} else {
|
||||
pdu->timeout = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue