Working on g++ compatibility
[invirt/third/libt4.git] / rsm.cc
diff --git a/rsm.cc b/rsm.cc
index 7e90b03..956f45d 100644 (file)
--- a/rsm.cc
+++ b/rsm.cc
@@ -121,7 +121,7 @@ void rsm::reg1(rpc_protocol::proc_id_t proc, handler *h) {
 }
 
 // The recovery thread runs this function
-void rsm::recovery() [[noreturn]] {
+void rsm::recovery() {
     bool r = true;
     lock ml(rsm_mutex);
 
@@ -356,6 +356,9 @@ rsm_client_protocol::status rsm::client_invoke(string & r, rpc_protocol::proc_id
         }
     }
     execute(procno, req, r);
+    for (size_t i=0; i<r.size(); i++) {
+        LOG(hex << setfill('0') << setw(2) << (unsigned int)(unsigned char)r[i]);
+    }
     last_myvs = vs;
     return rsm_client_protocol::OK;
 }
@@ -467,9 +470,8 @@ rsm_protocol::status rsm::joinreq(string & log, const string & m, viewstamp last
 }
 
 //
-// RPC handler: Send back all the nodes this local knows about to client
-// so the client can switch to a different primary
-// when it existing primary fails
+// RPC handler: Responds with the list of known nodes for fall-back on a
+// primary failure
 //
 rsm_client_protocol::status rsm::client_members(vector<string> &r, int) {
     vector<string> m;
@@ -512,12 +514,9 @@ bool rsm::amiprimary() {
 }
 
 
-// Testing server
-
-// Simulate partitions
+// Test RPCs -- simulate partitions and failures
 
-// assumes caller holds rsm_mutex
-void rsm::net_repair(bool heal, lock &) {
+void rsm::net_repair(bool heal, lock &/*rsm_mutex_lock*/) {
     vector<string> m;
     cfg->get_view(vid_commit, m);
     for (unsigned i  = 0; i < m.size(); i++) {
@@ -534,15 +533,12 @@ rsm_test_protocol::status rsm::test_net_repairreq(rsm_test_protocol::status &r,
     lock ml(rsm_mutex);
     LOG("heal " << heal << " (dopartition " <<
             dopartition << ", partitioned " << partitioned << ")");
-    if (heal) {
+    if (heal)
         net_repair(heal, ml);
-        partitioned = false;
-    } else {
+    else
         dopartition = true;
-        partitioned = false;
-    }
-    r = rsm_test_protocol::OK;
-    return r;
+    partitioned = false;
+    return r = rsm_test_protocol::OK;
 }
 
 // simulate failure at breakpoint 1 and 2