X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/a4175b2e216a20b86cc872dea8a08005c60617a5..4b9798f44ae94deabf87dd534337b55259272950:/rpc/rpc.cc diff --git a/rpc/rpc.cc b/rpc/rpc.cc index 5de3984..a3ffef1 100644 --- a/rpc/rpc.cc +++ b/rpc/rpc.cc @@ -128,7 +128,7 @@ int rpcc::bind(TO to) { int r; - int ret = call(rpc_const::bind, 0, r, to); + int ret = call_timeout(rpc_const::bind, to, r, 0); if(ret == 0){ lock ml(m_); bind_done_ = true; @@ -387,7 +387,6 @@ compress: } } - rpcs::rpcs(unsigned int p1, int count) : port_(p1), counting_(count), curr_counts_(count), lossytest_(0), reachable_ (true) { @@ -400,7 +399,7 @@ rpcs::rpcs(unsigned int p1, int count) lossytest_ = atoi(loss_env); } - reg(rpc_const::bind, this, &rpcs::rpcbind); + reg(rpc_const::bind, &rpcs::rpcbind, this); dispatchpool_ = new ThrPool(6,false); listener_ = new tcpsconn(this, port_, lossytest_); @@ -424,7 +423,7 @@ rpcs::got_pdu(connection *c, char *b, int sz) djob_t *j = new djob_t(c, b, sz); c->incref(); - bool succ = dispatchpool_->addObjJob(this, &rpcs::dispatch, j); + bool succ = dispatchpool_->addJob(std::bind(&rpcs::dispatch, this, j)); if(!succ || !reachable_){ c->decref(); delete j; @@ -564,14 +563,14 @@ rpcs::dispatch(djob_t *j) updatestat(proc); } - rh.ret = f->fn(req, rep); - if (rh.ret == rpc_const::unmarshal_args_failure) { - fprintf(stderr, "rpcs::dispatch: failed to" - " unmarshall the arguments. You are" - " probably calling RPC 0x%x with wrong" - " types of arguments.\n", proc); - VERIFY(0); - } + rh.ret = (*f)(req, rep); + if (rh.ret == rpc_const::unmarshal_args_failure) { + fprintf(stderr, "rpcs::dispatch: failed to" + " unmarshall the arguments. You are" + " probably calling RPC 0x%x with wrong" + " types of arguments.\n", proc); + VERIFY(0); + } VERIFY(rh.ret >= 0); rep.pack_reply_header(rh); @@ -725,7 +724,7 @@ rpcs::free_reply_window(void) // rpc handler int -rpcs::rpcbind(int a, int &r) +rpcs::rpcbind(int &r, int a) { jsl_log(JSL_DBG_2, "rpcs::rpcbind called return nonce %u\n", nonce_); r = nonce_;