X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/e0c49ff6ba44cf5b47ab91d58b67763f5a1c7a58..02967a43024ce81912cd1ec96a800397457f8066:/rpc/rpc.h diff --git a/rpc/rpc.h b/rpc/rpc.h index ddf15f9..9464e57 100644 --- a/rpc/rpc.h +++ b/rpc/rpc.h @@ -42,8 +42,6 @@ struct is_valid_registration< class rpcc : private connection_delegate { private: using proc_id_t = rpc_protocol::proc_id_t; - template - using proc_t = rpc_protocol::proc_t; using nonce_t = rpc_protocol::nonce_t; using xid_t = rpc_protocol::xid_t; @@ -94,16 +92,7 @@ class rpcc : private connection_delegate { request dup_req_; int xid_rep_done_ = -1; - int call_marshalled(proc_id_t proc, milliseconds to, string & rep, marshall & req); - - template - inline int call_m(proc_id_t proc, milliseconds to, R & r, marshall && req) { - string rep; - int intret = call_marshalled(proc, to, rep, req); - if (intret >= 0) - VERIFY(unmarshall(rep, true, r).okdone()); // guaranteed by static type checking - return intret; - } + int call_marshalled(const rpc_protocol::proc_t & proc, milliseconds to, string & rep, const marshall & req); bool got_pdu(const shared_ptr & c, const string & b); @@ -127,14 +116,19 @@ class rpcc : private connection_delegate { void cancel(lock & m_lock); template - inline int call(proc_t

proc, R & r, const Args & ... args) { + inline int call(const rpc_protocol::proc_checked_t

& proc, R & r, const Args & ... args) { return call_timeout(proc, rpc::to_max, r, args...); } template - inline int call_timeout(proc_t

proc, milliseconds to, R & r, const Args & ... args) { + inline int call_timeout(const rpc_protocol::proc_checked_t

& proc, milliseconds to, R & r, const Args & ... args) { static_assert(is_valid_call::value, "RPC called with incorrect argument types"); - return call_m(proc.id, to, r, std::forward(marshall(args...))); + string rep; + int intret = call_marshalled(proc, to, rep, marshall(args...)); + if (intret >= 0) { + VERIFY(unmarshall(rep, true, r).okdone()); // guaranteed by static type checking + } + return intret; } }; @@ -142,8 +136,6 @@ class rpcc : private connection_delegate { class rpcs : private connection_delegate { private: using proc_id_t = rpc_protocol::proc_id_t; - template - using proc_t = rpc_protocol::proc_t; using nonce_t = rpc_protocol::nonce_t; using xid_t = rpc_protocol::xid_t; @@ -208,7 +200,8 @@ class rpcs : private connection_delegate { void set_reachable(bool r) { reachable_ = r; } - template inline void reg(proc_t

proc, F f, C *c=nullptr) { + template + inline void reg(const rpc_protocol::proc_checked_t

& proc, F f, C *c=nullptr) { static_assert(is_valid_registration::value, "RPC handler registered with incorrect argument types"); struct ReturnOnFailure { static inline int unmarshall_args_failure() {