-lock_client::lock_client(string xdst, class lock_release_user *_lu) : lu(_lu) {
- sockaddr_in dstsock;
- make_sockaddr(xdst.c_str(), &dstsock);
- cl = new rpcc(dstsock);
- if (cl->bind() < 0) {
- printf("lock_client: call bind\n");
- }
-
- srand(time(NULL)^last_port);
- rlock_port = ((rand()%32000) | (0x1 << 10));
- const char *hname;
- // VERIFY(gethostname(hname, 100) == 0);
- hname = "127.0.0.1";
- ostringstream host;
- host << hname << ":" << rlock_port;
- id = host.str();
- last_port = rlock_port;
- rpcs *rlsrpc = new rpcs(rlock_port);
+lock_client::lock_client(string xdst, lock_release_user *_lu) : lu(_lu), next_xid(0) {
+ rlock_port = std::uniform_int_distribution<in_port_t>(1024,32000+1024)(global->random_generator);
+ id = "127.0.0.1:" + std::to_string(rlock_port);
+ rlsrpc = std::make_unique<rpcs>(rlock_port);