X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/06282fd37814c4a9d53bca089b048709b368f5b3..869c0cc91d8f6b2bb80026616372d16450b64d9f:/rsm_client.cc diff --git a/rsm_client.cc b/rsm_client.cc index 161ddb5..9906d39 100644 --- a/rsm_client.cc +++ b/rsm_client.cc @@ -1,6 +1,5 @@ #include "rsm_client.h" #include -#include #include rsm_client::rsm_client(string dst) : primary(dst) { @@ -19,10 +18,10 @@ rsm_protocol::status rsm_client::invoke(unsigned int proc, string & rep, const s lock ml(rsm_client_mutex); while (1) { LOG << "proc " << std::hex << proc << " primary " << primary; - handle h(primary); + string prim = primary; ml.unlock(); - rpcc *cl = h.safebind(); + auto cl = rpcc::bind_cached(prim); auto ret = rsm_client_protocol::OK; if (cl) ret = (rsm_client_protocol::status)cl->call_timeout(rsm_client_protocol::invoke, milliseconds(500), rep, proc, req); @@ -31,34 +30,34 @@ rsm_protocol::status rsm_client::invoke(unsigned int proc, string & rep, const s if (!cl) goto prim_fail; - LOG << "proc " << std::hex << proc << " primary " << primary << " ret " << std::dec << ret; + LOG << "proc " << std::hex << proc << " primary " << prim << " ret " << std::dec << ret; if (ret == rsm_client_protocol::OK) return rsm_protocol::OK; if (ret == rsm_client_protocol::BUSY) { - LOG << "rsm is busy " << primary; + LOG << "rsm is busy " << prim; usleep(300000); continue; } if (ret == rsm_client_protocol::NOTPRIMARY) { - LOG << "primary " << primary << " isn't the primary--let's get a complete list of mems"; + LOG << "primary " << prim << " isn't the primary--let's get a complete list of mems"; if (init_members(ml)) continue; } prim_fail: - LOG << "primary " << primary << " failed ret " << std::dec << ret; + LOG << "primary " << prim << " failed ret " << std::dec << ret; primary_failure(ml); - LOG << "retry new primary " << primary; + LOG << "retry new primary " << prim; } } bool rsm_client::init_members(lock & rsm_client_mutex_lock) { LOG << "get members!"; - handle h(primary); + string prim = primary; int ret = rsm_client_protocol::ERR; - rpcc *cl; + shared_ptr cl; { rsm_client_mutex_lock.unlock(); - cl = h.safebind(); + cl = rpcc::bind_cached(prim); if (cl) ret = cl->call_timeout(rsm_client_protocol::members, milliseconds(100), known_mems, 0); rsm_client_mutex_lock.lock();