class rpcc : private connection_delegate {
private:
using proc_id_t = rpc_protocol::proc_id_t;
- template <class S>
- using proc_t = rpc_protocol::proc_t<S>;
using nonce_t = rpc_protocol::nonce_t;
using xid_t = rpc_protocol::xid_t;
request dup_req_;
int xid_rep_done_ = -1;
- 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;
- 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<connection> & c, const string & b);
void cancel(lock & m_lock);
template<class P, class R, typename ...Args>
- inline int call(proc_t<P> proc, R & r, const Args & ... args) {
+ inline int call(const rpc_protocol::proc_checked_t<P> & proc, R & r, const Args & ... args) {
return call_timeout(proc, rpc::to_max, r, args...);
}
template<class P, class R, typename ...Args>
- inline int call_timeout(proc_t<P> proc, milliseconds to, R & r, const Args & ... args) {
+ inline int call_timeout(const rpc_protocol::proc_checked_t<P> & proc, milliseconds to, R & r, const Args & ... args) {
static_assert(is_valid_call<P, R, Args...>::value, "RPC called with incorrect argument types");
- return call_m(proc.id, to, r, std::forward<marshall>(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;
}
};
class rpcs : private connection_delegate {
private:
using proc_id_t = rpc_protocol::proc_id_t;
- template <class S>
- using proc_t = rpc_protocol::proc_t<S>;
using nonce_t = rpc_protocol::nonce_t;
using xid_t = rpc_protocol::xid_t;
void set_reachable(bool r) { reachable_ = r; }
- template<class P, class F, class C=void> inline void reg(proc_t<P> proc, F f, C *c=nullptr) {
+ template<class P, class F, class C=void>
+ inline void reg(const rpc_protocol::proc_checked_t<P> & proc, F f, C *c=nullptr) {
static_assert(is_valid_registration<P, F>::value, "RPC handler registered with incorrect argument types");
struct ReturnOnFailure {
static inline int unmarshall_args_failure() {