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);
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<std::chrono::milliseconds>(end - start).count();
if (ret != 0)
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);
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);
}
}
// 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");
{
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");
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");
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");