Cosmetic changes
authorPeter Iannucci <iannucci@mit.edu>
Fri, 17 Jan 2014 06:46:34 +0000 (01:46 -0500)
committerPeter Iannucci <iannucci@mit.edu>
Fri, 17 Jan 2014 07:08:54 +0000 (02:08 -0500)
config.cc
config.h
rpc/marshall.h
rpc/rpc.cc
rpc/rpc.h

index a177362..8a7bf65 100644 (file)
--- a/config.cc
+++ b/config.cc
@@ -37,7 +37,7 @@ using std::vector;
 config_view_change::~config_view_change() {}
 
 config::config(const string & _first, const string & _me, config_view_change *_vc)
 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);
       paxos(this, me == _first, me, me)
 {
     get_rpcs()->reg(paxos_protocol::heartbeat, &config::heartbeat, this);
index d2b33ba..8d0c836 100644 (file)
--- a/config.h
+++ b/config.h
@@ -12,7 +12,7 @@ class config_view_change {
 
 class config : public paxos_change {
     private:
 
 class config : public paxos_change {
     private:
-        unsigned my_view_id;
+        unsigned my_view_id = 0;
         string first;
         string me;
         config_view_change *vc;
         string first;
         string me;
         config_view_change *vc;
index 8d5812a..bf3cbc7 100644 (file)
@@ -4,10 +4,6 @@
 #include "types.h"
 #include "rpc_protocol.h"
 
 #include "types.h"
 #include "rpc_protocol.h"
 
-//
-// Marshall and unmarshall objects
-//
-
 class marshall {
     private:
         string buf_ = string(rpc_protocol::DEFAULT_RPC_SZ, 0);
 class marshall {
     private:
         string buf_ = string(rpc_protocol::DEFAULT_RPC_SZ, 0);
index 80ec124..a74d907 100644 (file)
@@ -145,7 +145,7 @@ void rpcc::cancel(lock & m_lock) {
     }
 }
 
     }
 }
 
-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;
 
     caller ca(0, &rep);
     xid_t xid_rep;
@@ -413,9 +413,9 @@ void rpcs::dispatch(shared_ptr<connection> c, const string & buf) {
             conns_[h.clt_nonce] = c;
     }
 
             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) {
         case NEW: // new request
             rh.ret = (*f)(std::forward<unmarshall>(req), rep);
             if (rh.ret == rpc_protocol::unmarshall_args_failure) {
@@ -427,13 +427,13 @@ void rpcs::dispatch(shared_ptr<connection> c, const string & buf) {
             VERIFY(rh.ret >= 0);
 
             rep.write_header(rh);
             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;
 
                             << 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
             {
 
             // get the latest connection to the client
             {
@@ -442,12 +442,12 @@ void rpcs::dispatch(shared_ptr<connection> c, const string & buf) {
                     c = conns_[h.clt_nonce];
             }
 
                     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
             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;
             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;
index c0f8d43..ddf15f9 100644 (file)
--- a/rpc/rpc.h
+++ b/rpc/rpc.h
@@ -94,12 +94,12 @@ class rpcc : private connection_delegate {
         request dup_req_;
         int xid_rep_done_ = -1;
 
         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;
 
         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;
             if (intret >= 0)
                 VERIFY(unmarshall(rep, true, r).okdone()); // guaranteed by static type checking
             return intret;