Clean-ups to logging and type signatures
[invirt/third/libt4.git] / handle.cc
index 3b6e1fa..5287a35 100644 (file)
--- a/handle.cc
+++ b/handle.cc
@@ -34,7 +34,7 @@ rpcc * handle::safebind() {
     if (h->cl)
         return h->cl;
     rpcc *cl = new rpcc(h->m);
-    LOG("handler_mgr::acquire_handle trying to bind..." << h->m);
+    LOG("trying to bind..." << h->m);
     // The test script assumes that the failure can be detected by paxos and
     // rsm layer within few seconds. We have to set the timeout with a small
     // value to support the assumption.
@@ -42,11 +42,11 @@ rpcc * handle::safebind() {
     // With RPC_LOSSY=5, tests may fail due to delays and time outs.
     int ret = cl->bind(rpcc::to(1000));
     if (ret < 0) {
-        LOG("handle_mgr::acquire_handle bind failure! " << h->m << " " << ret);
+        LOG("bind failure! " << h->m << " " << ret);
         delete cl;
         h->del = true;
     } else {
-        LOG("handle_mgr::acquire_handle bind succeeded " << h->m);
+        LOG("bind succeeded " << h->m);
         h->cl = cl;
     }
     return h->cl;
@@ -62,10 +62,11 @@ hinfo * handle_mgr::acquire_handle(string m) {
     if (hmap.find(m) == hmap.end()) {
         h = new hinfo(m);
         hmap[m] = h;
+        h->refcnt++;
     } else if (!hmap[m]->del) {
         h = hmap[m];
+        h->refcnt++;
     }
-    h->refcnt++;
     return h;
 }
 
@@ -82,10 +83,10 @@ void handle_mgr::delete_handle(const string & m) {
 
 void handle_mgr::delete_handle(const string & m, lock &) {
     if (hmap.find(m) == hmap.end()) {
-        LOG("handle_mgr::delete_handle: cl " << m << " isn't in cl list");
+        LOG("cl " << m << " isn't in cl list");
         return;
     }
-    LOG("handle_mgr::delete_handle: cl " << m << " refcnt " << hmap[m]->refcnt);
+    LOG("cl " << m << " refcnt " << hmap[m]->refcnt);
     hinfo *h = hmap[m];
     if (h->refcnt == 0) {
         if (h->cl) {