More cleanups to marshalling logic.
[invirt/third/libt4.git] / rpc / rpc.h
index 245f277..20a0aa9 100644 (file)
--- a/rpc/rpc.h
+++ b/rpc/rpc.h
@@ -27,12 +27,6 @@ class rpc_const {
         static const int cancel_failure = -7;
 };
 
-struct ReturnOnFailure {
-    static inline int unmarshall_args_failure() {
-        return rpc_const::unmarshal_args_failure;
-    }
-};
-
 // rpc client endpoint.
 // manages a xid space per destination socket
 // threaded: multiple threads can be sending RPCs,
@@ -76,16 +70,16 @@ class rpcc : public chanmgr {
 
         std::map<int, caller *> calls_;
         std::list<unsigned int> xid_rep_window_;
-                
-                struct request {
-                    request() { clear(); }
-                    void clear() { buf.clear(); xid = -1; }
-                    bool isvalid() { return xid != -1; }
-                    std::string buf;
-                    int xid;
-                };
-                struct request dup_req_;
-                int xid_rep_done_;
+
+        struct request {
+            request() { clear(); }
+            void clear() { buf.clear(); xid = -1; }
+            bool isvalid() { return xid != -1; }
+            std::string buf;
+            int xid;
+        };
+        struct request dup_req_;
+        int xid_rep_done_;
     public:
 
         rpcc(sockaddr_in d, bool retrans=true);
@@ -258,8 +252,14 @@ class rpcs : public chanmgr {
     template<class F, class C=void> void reg(unsigned int proc, F f, C *c=nullptr);
 };
 
+struct ReturnOnFailure {
+    static inline int unmarshall_args_failure() {
+        return rpc_const::unmarshal_args_failure;
+    }
+};
+
 template<class F, class C> void rpcs::reg(unsigned int proc, F f, C *c) {
-    reg1(proc, marshalled_func<F, F, ReturnOnFailure>::wrap(f, c));
+    reg1(proc, marshalled_func<F, ReturnOnFailure>::wrap(f, c));
 }
 
 void make_sockaddr(const char *hostandport, struct sockaddr_in *dst);