Cosmetic improvements.
[invirt/third/libt4.git] / rsm_client.h
index be66fec..06ca5a6 100644 (file)
@@ -19,7 +19,7 @@ class rsm_client {
         mutex rsm_client_mutex;
         void primary_failure(lock & rsm_client_mutex_lock);
         bool init_members(lock & rsm_client_mutex_lock);
-        rsm_protocol::status invoke(unsigned int proc, string &rep, const string &req);
+        rsm_protocol::status invoke(unsigned int proc, string & rep, const string & req);
         template<class R> int call_m(unsigned int proc, R & r, const marshall & req);
     public:
         rsm_client(string dst);
@@ -27,7 +27,7 @@ class rsm_client {
         template<class P, class R, class ...Args>
         int call(rpc_protocol::proc_t<P> proc, R & r, const Args & ...a1) {
             static_assert(is_valid_call<P, R, Args...>::value, "RSM method invoked with incorrect argument types");
-            return call_m(proc.id, r, marshall{a1...});
+            return call_m(proc.id, r, marshall(a1...));
         }
 };
 
@@ -43,12 +43,11 @@ inline string hexify(const string & s) {
 template<class R>
 int rsm_client::call_m(unsigned int proc, R & r, const marshall & req) {
     string rep;
-    string res;
     int intret = invoke(proc, rep, req.content());
     VERIFY( intret == rsm_client_protocol::OK );
-    unmarshall u(rep, false);
-    u >> intret;
+    unmarshall u(rep, false, intret);
     if (intret < 0) return intret;
+    string res;
     u >> res;
     if (!u.okdone()) {
         LOG("failed to unmarshall the reply.");
@@ -57,17 +56,15 @@ int rsm_client::call_m(unsigned int proc, R & r, const marshall & req) {
             "0x" << hex << proc << " with the wrong return type");
         LOG("here's what I got: \"" << hexify(rep) << "\"");
         VERIFY(0);
-        return rpc_protocol::unmarshal_reply_failure;
+        return rpc_protocol::unmarshall_reply_failure;
     }
-    unmarshall u1(res, false);
-    u1 >> r;
-    if(!u1.okdone()) {
+    if(!unmarshall(res, false, r).okdone()) {
         LOG("failed to unmarshall the reply.");
         LOG("You are probably calling RPC 0x" << hex << proc <<
             " with the wrong return type.");
         LOG("here's what I got: \"" << hexify(res) << "\"");
         VERIFY(0);
-        return rpc_protocol::unmarshal_reply_failure;
+        return rpc_protocol::unmarshall_reply_failure;
     }
     return intret;
 }