X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/a5f10a497bebfc680bf418193f1fd9f1ad7cc417..603bac8fcb3697f283e6537d81b4a92e457ebbad:/rpc/rpctest.cc?ds=sidebyside diff --git a/rpc/rpctest.cc b/rpc/rpctest.cc index 47d5bce..2f58e5d 100644 --- a/rpc/rpctest.cc +++ b/rpc/rpctest.cc @@ -52,7 +52,7 @@ srv::handle_fast(int &r, const int a) int srv::handle_slow(int &r, const int a) { - usleep(random() % 5000); + usleep(random() % 500); r = a + 2; return 0; } @@ -166,7 +166,7 @@ client3(void *xx) for(int i = 0; i < 4; i++){ int rep = 0; - int ret = c->call_timeout(24, rpcc::to(3000), rep, i); + int ret = c->call_timeout(24, rpcc::to(300), rep, i); VERIFY(ret == rpc_const::timeout_failure || rep == i+2); } } @@ -187,14 +187,14 @@ simple_tests(rpcc *c) cout << " -- string concat RPC .. ok" << endl; // small request, big reply (perhaps req via UDP, reply via TCP) - intret = c->call_timeout(25, rpcc::to(200000), rep, 70000); + intret = c->call_timeout(25, rpcc::to(20000), rep, 70000); VERIFY(intret == 0); VERIFY(rep.size() == 70000); cout << " -- small request, big reply .. ok" << endl; // specify a timeout value to an RPC that should succeed (udp) int xx = 0; - intret = c->call_timeout(23, rpcc::to(3000), xx, 77); + intret = c->call_timeout(23, rpcc::to(300), xx, 77); VERIFY(intret == 0 && xx == 78); cout << " -- no spurious timeout .. ok" << endl; @@ -202,7 +202,7 @@ simple_tests(rpcc *c) { string arg(1000, 'x'); string rep2; - c->call_timeout(22, rpcc::to(3000), rep2, arg, (string)"x"); + c->call_timeout(22, rpcc::to(300), rep2, arg, (string)"x"); VERIFY(rep2.size() == 1001); cout << " -- no spurious timeout .. ok" << endl; } @@ -217,7 +217,7 @@ simple_tests(rpcc *c) string non_existent = "127.0.0.1:7661"; rpcc *c1 = new rpcc(non_existent); time_t t0 = time(0); - intret = c1->bind(rpcc::to(3000)); + intret = c1->bind(rpcc::to(300)); time_t t1 = time(0); VERIFY(intret < 0 && (t1 - t0) <= 4); cout << " -- rpc timeout .. ok" << endl; @@ -425,6 +425,6 @@ main(int argc, char *argv[]) } while (1) { - sleep(1); + usleep(100000); } }