X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/869c0cc91d8f6b2bb80026616372d16450b64d9f..c06ef44e7af1571710fd31dd0ab068dd77b1eb2d:/lock_client.cc diff --git a/lock_client.cc b/lock_client.cc index 009e051..e1bd62f 100644 --- a/lock_client.cc +++ b/lock_client.cc @@ -20,8 +20,6 @@ void lock_state::signal(thread::id who) { c[who].notify_one(); } -in_port_t lock_client::last_port = 0; - lock_state & lock_client::get_lock_state(lock_protocol::lockid_t lid) { lock sl(lock_table_lock); return lock_table[lid]; // creates the lock if it doesn't already exist @@ -32,10 +30,8 @@ lock_client::lock_client(string xdst, lock_release_user *_lu) : lu(_lu), next_xi if (cl->bind() < 0) LOG << "lock_client: call bind"; - srandom((uint32_t)time(NULL)^last_port); - rlock_port = ((random()%32000) | (0x1 << 10)); + rlock_port = std::uniform_int_distribution(1024,32000+1024)(global->random_generator); id = "127.0.0.1:" + std::to_string(rlock_port); - last_port = rlock_port; rlsrpc = unique_ptr(new rpcs(rlock_port)); rlsrpc->reg(rlock_protocol::revoke, &lock_client::revoke_handler, this); rlsrpc->reg(rlock_protocol::retry, &lock_client::retry_handler, this);