X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/869c0cc91d8f6b2bb80026616372d16450b64d9f..c06ef44e7af1571710fd31dd0ab068dd77b1eb2d:/rpc/rpc.cc?ds=inline diff --git a/rpc/rpc.cc b/rpc/rpc.cc index 2889db9..5d28f8f 100644 --- a/rpc/rpc.cc +++ b/rpc/rpc.cc @@ -63,17 +63,11 @@ using std::list; using namespace std::chrono; -inline void set_rand_seed() { - auto now = time_point_cast(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)) { - set_rand_seed(); - clt_nonce_ = (nonce_t)random(); + clt_nonce_ = (nonce_t)global->random_generator(); char *loss_env = getenv("RPC_LOSSY"); if (loss_env) @@ -335,8 +329,7 @@ compress: 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);