9 hinfo(const string & m_) : m(m_) {}
12 static mutex mgr_mutex;
13 static map<string, shared_ptr<hinfo>> hmap;
15 static shared_ptr<hinfo> acquire_handle(string m) {
17 shared_ptr<hinfo> h = hmap[m];
19 return (hmap[m] = make_shared<hinfo>(m));
23 static void delete_handle(const string & m, lock &) {
24 if (hmap.find(m) == hmap.end()) {
25 LOG_NONMEMBER("cl " << m << " isn't in cl list");
30 LOG_NONMEMBER("cl " << m << " refcnt " << hmap[m].use_count());
34 void invalidate_handle(const string & m) {
39 handle::handle(const string & m) : h(acquire_handle(m)) {}
41 rpcc * handle::safebind() {
44 lock ml(h->client_mutex);
48 unique_ptr<rpcc> cl(new rpcc(h->m));
49 LOG("trying to bind..." << h->m);
50 // The test script assumes that the failure can be detected by paxos and
51 // rsm layer within few seconds. We have to set the timeout with a small
52 // value to support the assumption.
54 // With RPC_LOSSY=5, tests may fail due to delays and time outs.
55 int ret = cl->bind(milliseconds(1000));
57 LOG("bind failure! " << h->m << " " << ret);
60 LOG("bind succeeded " << h->m);