projects
/
invirt/third/libt4.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Global destructor clean-ups and python test fixes
[invirt/third/libt4.git]
/
rsm_client.cc
diff --git
a/rsm_client.cc
b/rsm_client.cc
index
e5e4c2b
..
161ddb5
100644
(file)
--- a/
rsm_client.cc
+++ b/
rsm_client.cc
@@
-1,14
+1,13
@@
-#include "types.h"
#include "rsm_client.h"
#include <arpa/inet.h>
#include <handle.h>
#include <unistd.h>
rsm_client::rsm_client(string dst) : primary(dst) {
#include "rsm_client.h"
#include <arpa/inet.h>
#include <handle.h>
#include <unistd.h>
rsm_client::rsm_client(string dst) : primary(dst) {
- LOG("create rsm_client");
+ LOG << "create rsm_client";
lock ml(rsm_client_mutex);
VERIFY (init_members(ml));
lock ml(rsm_client_mutex);
VERIFY (init_members(ml));
- LOG("rsm_client: done");
+ LOG << "done";
}
void rsm_client::primary_failure(lock &) {
}
void rsm_client::primary_failure(lock &) {
@@
-16,44
+15,44
@@
void rsm_client::primary_failure(lock &) {
known_mems.pop_back();
}
known_mems.pop_back();
}
-rsm_protocol::status rsm_client::invoke(unsigned int proc, string &rep, const string &req) {
+rsm_protocol::status rsm_client::invoke(unsigned int proc, string & rep, const string & req) {
lock ml(rsm_client_mutex);
while (1) {
lock ml(rsm_client_mutex);
while (1) {
- LOG("proc " << hex << proc << " primary " << primary);
+ LOG << "proc " << std::hex << proc << " primary " << primary;
handle h(primary);
ml.unlock();
rpcc *cl = h.safebind();
auto ret = rsm_client_protocol::OK;
if (cl)
handle h(primary);
ml.unlock();
rpcc *cl = h.safebind();
auto ret = rsm_client_protocol::OK;
if (cl)
- ret = (rsm_client_protocol::status)cl->call_timeout(rsm_client_protocol::invoke, rpcc::to(5000), rep, proc, req);
+ ret = (rsm_client_protocol::status)cl->call_timeout(rsm_client_protocol::invoke, milliseconds(500), rep, proc, req);
ml.lock();
if (!cl)
goto prim_fail;
ml.lock();
if (!cl)
goto prim_fail;
- LOG("proc " << hex << proc << " primary " << primary << " ret " << dec << ret);
+ LOG << "proc " << std::hex << proc << " primary " << primary << " ret " << std::dec << ret;
if (ret == rsm_client_protocol::OK)
return rsm_protocol::OK;
if (ret == rsm_client_protocol::BUSY) {
if (ret == rsm_client_protocol::OK)
return rsm_protocol::OK;
if (ret == rsm_client_protocol::BUSY) {
- LOG("rsm is busy " << primary);
- sleep(3);
+ LOG << "rsm is busy " << primary;
+ usleep(300000);
continue;
}
if (ret == rsm_client_protocol::NOTPRIMARY) {
continue;
}
if (ret == rsm_client_protocol::NOTPRIMARY) {
- LOG("primary " << primary << " isn't the primary--let's get a complete list of mems");
+ LOG << "primary " << primary << " isn't the primary--let's get a complete list of mems";
if (init_members(ml))
continue;
}
prim_fail:
if (init_members(ml))
continue;
}
prim_fail:
- LOG("primary " << primary << " failed ret " << dec << ret);
+ LOG << "primary " << primary << " failed ret " << std::dec << ret;
primary_failure(ml);
primary_failure(ml);
- LOG("retry new primary " << primary);
+ LOG << "retry new primary " << primary;
}
}
bool rsm_client::init_members(lock & rsm_client_mutex_lock) {
}
}
bool rsm_client::init_members(lock & rsm_client_mutex_lock) {
- LOG("get members!");
+ LOG << "get members!";
handle h(primary);
int ret = rsm_client_protocol::ERR;
rpcc *cl;
handle h(primary);
int ret = rsm_client_protocol::ERR;
rpcc *cl;
@@
-61,20
+60,20
@@
bool rsm_client::init_members(lock & rsm_client_mutex_lock) {
rsm_client_mutex_lock.unlock();
cl = h.safebind();
if (cl)
rsm_client_mutex_lock.unlock();
cl = h.safebind();
if (cl)
- ret = cl->call_timeout(rsm_client_protocol::members, rpcc::to(1000), known_mems, 0);
+ ret = cl->call_timeout(rsm_client_protocol::members, milliseconds(100), known_mems, 0);
rsm_client_mutex_lock.lock();
}
if (cl == 0 || ret != rsm_protocol::OK)
return false;
if (known_mems.size() < 1) {
rsm_client_mutex_lock.lock();
}
if (cl == 0 || ret != rsm_protocol::OK)
return false;
if (known_mems.size() < 1) {
- LOG("do not know any members!");
+ LOG << "do not know any members!";
VERIFY(0);
}
primary = known_mems.back();
known_mems.pop_back();
VERIFY(0);
}
primary = known_mems.back();
known_mems.pop_back();
- LOG("primary " << primary);
+ LOG << "primary " << primary;
return true;
}
return true;
}