projects
/
invirt/third/libt4.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
All random numbers generated via one PRNG seeded in one place.
[invirt/third/libt4.git]
/
rpc
/
rpc.cc
diff --git
a/rpc/rpc.cc
b/rpc/rpc.cc
index
2889db9
..
5d28f8f
100644
(file)
--- a/
rpc/rpc.cc
+++ b/
rpc/rpc.cc
@@
-63,17
+63,11
@@
using std::list;
using namespace std::chrono;
using std::list;
using namespace std::chrono;
-inline void set_rand_seed() {
- auto now = time_point_cast<nanoseconds>(steady_clock::now());
- srandom((uint32_t)now.time_since_epoch().count()^(uint32_t)getpid());
-}
-
static sockaddr_in make_sockaddr(const string & hostandport);
rpcc::rpcc(const string & d) : dst_(make_sockaddr(d))
{
static sockaddr_in make_sockaddr(const string & hostandport);
rpcc::rpcc(const string & d) : dst_(make_sockaddr(d))
{
- set_rand_seed();
- clt_nonce_ = (nonce_t)random();
+ clt_nonce_ = (nonce_t)global->random_generator();
char *loss_env = getenv("RPC_LOSSY");
if (loss_env)
char *loss_env = getenv("RPC_LOSSY");
if (loss_env)
@@
-335,8
+329,7
@@
compress:
rpcs::rpcs(in_port_t p1) : port_(p1)
{
rpcs::rpcs(in_port_t p1) : port_(p1)
{
- set_rand_seed();
- nonce_ = (nonce_t)random();
+ nonce_ = (nonce_t)global->random_generator();
IF_LEVEL(2) LOG << "created with nonce " << nonce_;
reg(rpc_protocol::bind, &rpcs::rpcbind, this);
IF_LEVEL(2) LOG << "created with nonce " << nonce_;
reg(rpc_protocol::bind, &rpcs::rpcbind, this);