Rolled handle infrastructure into rpcc.
[invirt/third/libt4.git] / config.cc
index 4931a9f..a177362 100644 (file)
--- a/config.cc
+++ b/config.cc
@@ -1,5 +1,4 @@
 #include "config.h"
-#include "handle.h"
 
 using std::vector;
 
@@ -85,7 +84,7 @@ void config::paxos_commit(unsigned instance, const string & value) {
         LOG << "is " << mem << " still a member?";
         if (!isamember(mem, newmem) && me != mem) {
             LOG << "delete " << mem;
-            handle(mem).invalidate();
+            rpcc::unbind_cached(mem);
         }
     }
 
@@ -198,11 +197,10 @@ config::heartbeat_t config::doheartbeat(const string & m, lock & cfg_mutex_lock)
     VERIFY(cfg_mutex_lock);
     unsigned vid = my_view_id;
     LOG << "heartbeat to " << m << " (" << vid << ")";
-    handle h(m);
 
     cfg_mutex_lock.unlock();
     int r = 0, ret = rpc_protocol::bind_failure;
-    if (rpcc *cl = h.safebind())
+    if (auto cl = rpcc::bind_cached(m))
         ret = cl->call_timeout(paxos_protocol::heartbeat, milliseconds(100), r, me, vid);
     cfg_mutex_lock.lock();
 
@@ -212,7 +210,7 @@ config::heartbeat_t config::doheartbeat(const string & m, lock & cfg_mutex_lock)
             break;
         case rpc_protocol::atmostonce_failure:
         case rpc_protocol::oldsrv_failure:
-            h.invalidate();
+            rpcc::unbind_cached(m);
             break;
         default:
             LOG << "problem with " << m << " (" << ret << ") my vid " << vid << " his vid " << r;