8 handle::handle(std::string m)
10 h = mgr.get_handle(m);
24 make_sockaddr(h->m.c_str(), &dstsock);
25 rpcc *cl = new rpcc(dstsock);
26 tprintf("handler_mgr::get_handle trying to bind...%s\n", h->m.c_str());
28 // The test script assumes that the failure can be detected by paxos and
29 // rsm layer within few seconds. We have to set the timeout with a small
30 // value to support the assumption.
32 // With RPC_LOSSY=5, tests may fail due to delays and time outs.
33 ret = cl->bind(rpcc::to(1000));
35 tprintf("handle_mgr::get_handle bind failure! %s %d\n", h->m.c_str(), ret);
39 tprintf("handle_mgr::get_handle bind succeeded %s\n", h->m.c_str());
47 if (h) mgr.done_handle(h);
50 handle_mgr::handle_mgr()
55 handle_mgr::get_handle(std::string m)
57 lock ml(handle_mutex);
59 if (hmap.find(m) == hmap.end()) {
66 } else if (!hmap[m]->del) {
74 handle_mgr::done_handle(struct hinfo *h)
76 lock ml(handle_mutex);
78 if (h->refcnt == 0 && h->del)
79 delete_handle_wo(h->m);
83 handle_mgr::delete_handle(std::string m)
85 lock ml(handle_mutex);
89 // Must be called with handle_mutex locked.
91 handle_mgr::delete_handle_wo(std::string m)
93 if (hmap.find(m) == hmap.end()) {
94 tprintf("handle_mgr::delete_handle_wo: cl %s isn't in cl list\n", m.c_str());
96 tprintf("handle_mgr::delete_handle_wo: cl %s refcnt %d\n", m.c_str(),
98 struct hinfo *h = hmap[m];