X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/dfe8486473094c0769fd1922329c3f0dfd8f43c0..130f2d53438eb6193accb445aca52fa8e2fe4158:/rpc/rpctest.cc diff --git a/rpc/rpctest.cc b/rpc/rpctest.cc index 115f484..c43a9da 100644 --- a/rpc/rpctest.cc +++ b/rpc/rpctest.cc @@ -119,7 +119,7 @@ client1(int cl) for(int i = 0; i < 100; i++){ int arg = (random() % 2000); std::string rep; - int ret = clients[which_cl]->call(25, arg, rep); + int ret = clients[which_cl]->call(25, rep, arg); VERIFY(ret == 0); if ((int)rep.size()!=arg) { printf("repsize wrong %d!=%d\n", (int)rep.size(), arg); @@ -136,7 +136,7 @@ client1(int cl) auto start = std::chrono::steady_clock::now(); - int ret = clients[which_cl]->call(which ? 23 : 24, arg, rep); + int ret = clients[which_cl]->call(which ? 23 : 24, rep, arg); auto end = std::chrono::steady_clock::now(); int diff = std::chrono::duration_cast(end - start).count(); if (ret != 0) @@ -157,7 +157,7 @@ client2(int cl) while(time(0) - t1 < 10){ int arg = (random() % 2000); std::string rep; - int ret = clients[which_cl]->call(25, arg, rep); + int ret = clients[which_cl]->call(25, rep, arg); if ((int)rep.size()!=arg) { printf("ask for %d reply got %d ret %d\n", arg, (int)rep.size(), ret); @@ -173,7 +173,7 @@ client3(void *xx) for(int i = 0; i < 4; i++){ int rep; - int ret = c->call(24, i, rep, rpcc::to(3000)); + int ret = c->call_timeout(24, rpcc::to(3000), rep, i); VERIFY(ret == rpc_const::timeout_failure || rep == i+2); } } @@ -188,20 +188,20 @@ simple_tests(rpcc *c) // to marshall the RPC call packet, and how to unmarshall // the reply packet. std::string rep; - int intret = c->call(22, (std::string)"hello", (std::string)" goodbye", rep); + int intret = c->call(22, rep, (std::string)"hello", (std::string)" goodbye"); VERIFY(intret == 0); // this is what handle_22 returns VERIFY(rep == "hello goodbye"); printf(" -- string concat RPC .. ok\n"); // small request, big reply (perhaps req via UDP, reply via TCP) - intret = c->call(25, 70000, rep, rpcc::to(200000)); + intret = c->call_timeout(25, rpcc::to(200000), rep, 70000); VERIFY(intret == 0); VERIFY(rep.size() == 70000); printf(" -- small request, big reply .. ok\n"); // specify a timeout value to an RPC that should succeed (udp) int xx = 0; - intret = c->call(23, 77, xx, rpcc::to(3000)); + intret = c->call_timeout(23, rpcc::to(3000), xx, 77); VERIFY(intret == 0 && xx == 78); printf(" -- no suprious timeout .. ok\n"); @@ -209,14 +209,14 @@ simple_tests(rpcc *c) { std::string arg(1000, 'x'); std::string rep; - c->call(22, arg, (std::string)"x", rep, rpcc::to(3000)); + c->call_timeout(22, rpcc::to(3000), rep, arg, (std::string)"x"); VERIFY(rep.size() == 1001); printf(" -- no suprious timeout .. ok\n"); } // huge RPC std::string big(1000000, 'x'); - intret = c->call(22, big, (std::string)"z", rep); + intret = c->call(22, rep, big, (std::string)"z"); VERIFY(rep.size() == 1000001); printf(" -- huge 1M rpc request .. ok\n"); @@ -302,7 +302,7 @@ failure_test() startserver(); std::string rep; - int intret = client->call(22, (std::string)"hello", (std::string)" goodbye", rep); + int intret = client->call(22, rep, (std::string)"hello", (std::string)" goodbye"); VERIFY(intret == rpc_const::oldsrv_failure); printf(" -- call recovered server with old client .. failed ok\n"); @@ -312,7 +312,7 @@ failure_test() VERIFY (client->bind() >= 0); VERIFY (client->bind() < 0); - intret = client->call(22, (std::string)"hello", (std::string)" goodbye", rep); + intret = client->call(22, rep, (std::string)"hello", (std::string)" goodbye"); VERIFY(intret == 0); VERIFY(rep == "hello goodbye");