X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/3615d9bf0b254442e2fddee45475dbd634cf703a..8b9d106fcc61fc84712c97d4db060d8302cc63fd:/rpc/rpc.cc diff --git a/rpc/rpc.cc b/rpc/rpc.cc index 2c1f1a5..a08e287 100644 --- a/rpc/rpc.cc +++ b/rpc/rpc.cc @@ -52,10 +52,8 @@ x exited worker threads). */ -#include "types.h" #include "rpc.h" -#include #include #include #include @@ -344,17 +342,19 @@ rpcs::rpcs(in_port_t p1, size_t count) IF_LEVEL(2) LOG("created with nonce " << nonce_); reg(rpc_const::bind, &rpcs::rpcbind, this); - dispatchpool_ = new ThrPool(6, false); + dispatchpool_ = unique_ptr(new ThrPool(6, false)); +} +void rpcs::start() { char *loss_env = getenv("RPC_LOSSY"); - listener_ = new tcpsconn(this, port_, loss_env ? atoi(loss_env) : 0); + listener_ = unique_ptr(new tcpsconn(this, port_, loss_env ? atoi(loss_env) : 0)); } rpcs::~rpcs() { // must delete listener before dispatchpool - delete listener_; - delete dispatchpool_; + listener_ = nullptr; + dispatchpool_ = nullptr; free_reply_window(); } @@ -436,7 +436,7 @@ void rpcs::dispatch(shared_ptr c, const string & buf) { { lock pl(procs_m_); if(procs_.count(proc) < 1){ - cerr << "unknown proc " << hex << proc << "." << endl; + LOG("unknown proc 0x" << hex << proc << " with h.srv_nonce=" << h.srv_nonce << ", my srv_nonce=" << nonce_); VERIFY(0); return; } @@ -477,9 +477,8 @@ void rpcs::dispatch(shared_ptr c, const string & buf) { switch (stat) { case NEW: // new request - if (counting_){ + if (counting_) updatestat(proc); - } rh.ret = (*f)(req, rep); if (rh.ret == rpc_const::unmarshal_args_failure) {