config_view_change::~config_view_change() {}
config::config(const string & _first, const string & _me, config_view_change *_vc)
- : my_view_id(0), first(_first), me(_me), vc(_vc),
+ : first(_first), me(_me), vc(_vc),
paxos(this, me == _first, me, me)
{
get_rpcs()->reg(paxos_protocol::heartbeat, &config::heartbeat, this);
class config : public paxos_change {
private:
- unsigned my_view_id;
+ unsigned my_view_id = 0;
string first;
string me;
config_view_change *vc;
#include "types.h"
#include "rpc_protocol.h"
-//
-// Marshall and unmarshall objects
-//
-
class marshall {
private:
string buf_ = string(rpc_protocol::DEFAULT_RPC_SZ, 0);
}
}
-int rpcc::call1(proc_id_t proc, milliseconds to, string & rep, marshall & req) {
+int rpcc::call_marshalled(proc_id_t proc, milliseconds to, string & rep, marshall & req) {
caller ca(0, &rep);
xid_t xid_rep;
conns_[h.clt_nonce] = c;
}
- string b1;
+ string stored_reply;
- switch (check_duplicate_and_update(h.clt_nonce, h.xid, h.xid_rep, b1)) {
+ switch (check_duplicate_and_update(h.clt_nonce, h.xid, h.xid_rep, stored_reply)) {
case NEW: // new request
rh.ret = (*f)(std::forward<unmarshall>(req), rep);
if (rh.ret == rpc_protocol::unmarshall_args_failure) {
VERIFY(rh.ret >= 0);
rep.write_header(rh);
- b1 = rep;
+ stored_reply = rep;
- IF_LEVEL(2) LOG << "sending and saving reply of size " << b1.size() << " for rpc "
+ IF_LEVEL(2) LOG << "sending and saving reply of size " << stored_reply.size() << " for rpc "
<< h.xid << ", proc " << std::hex << proc << " ret " << std::dec
<< rh.ret << ", clt " << h.clt_nonce;
- add_reply(h.clt_nonce, h.xid, b1);
+ add_reply(h.clt_nonce, h.xid, stored_reply);
// get the latest connection to the client
{
c = conns_[h.clt_nonce];
}
- c->send(rep);
+ c->send(stored_reply);
break;
case INPROGRESS: // server is working on this request
break;
case DONE: // duplicate and we still have the response
- c->send(b1);
+ c->send(stored_reply);
break;
case FORGOTTEN: // very old request and we don't have the response anymore
IF_LEVEL(2) LOG << "very old request " << h.xid << " from " << h.clt_nonce;
request dup_req_;
int xid_rep_done_ = -1;
- int call1(proc_id_t proc, milliseconds to, string & rep, marshall & req);
+ int call_marshalled(proc_id_t proc, milliseconds to, string & rep, marshall & req);
template<class R>
inline int call_m(proc_id_t proc, milliseconds to, R & r, marshall && req) {
string rep;
- int intret = call1(proc, to, rep, req);
+ int intret = call_marshalled(proc, to, rep, req);
if (intret >= 0)
VERIFY(unmarshall(rep, true, r).okdone()); // guaranteed by static type checking
return intret;