- int handle_22(const std::string a, const std::string b, std::string & r);
- int handle_fast(const int a, int &r);
- int handle_slow(const int a, int &r);
- int handle_bigrep(const int a, std::string &r);
+ int handle_22(std::string & r, const std::string a, const std::string b);
+ int handle_fast(int &r, const int a);
+ int handle_slow(int &r, const int a);
+ int handle_bigrep(std::string &r, const int a);
// at these argument types, so this function definition
// does what a .x file does in SunRPC.
int
// at these argument types, so this function definition
// does what a .x file does in SunRPC.
int
- server->reg(22, &service, &srv::handle_22);
- server->reg(23, &service, &srv::handle_fast);
- server->reg(24, &service, &srv::handle_slow);
- server->reg(25, &service, &srv::handle_bigrep);
+ server->reg(22, &srv::handle_22, &service);
+ server->reg(23, &srv::handle_fast, &service);
+ server->reg(24, &srv::handle_slow, &service);
+ server->reg(25, &srv::handle_bigrep, &service);
- req_header rh(1,2,3,4,5);
+ request_header rh{1,2,3,4,5};
un.unpack_req_header(&rh1);
VERIFY(memcmp(&rh,&rh1,sizeof(rh))==0);
int i1;
un.unpack_req_header(&rh1);
VERIFY(memcmp(&rh,&rh1,sizeof(rh))==0);
int i1;
VERIFY(ret == 0);
if ((int)rep.size()!=arg) {
printf("repsize wrong %d!=%d\n", (int)rep.size(), arg);
VERIFY(ret == 0);
if ((int)rep.size()!=arg) {
printf("repsize wrong %d!=%d\n", (int)rep.size(), arg);
auto end = std::chrono::steady_clock::now();
int diff = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
if (ret != 0)
auto end = std::chrono::steady_clock::now();
int diff = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
if (ret != 0)
if ((int)rep.size()!=arg) {
printf("ask for %d reply got %d ret %d\n",
arg, (int)rep.size(), ret);
if ((int)rep.size()!=arg) {
printf("ask for %d reply got %d ret %d\n",
arg, (int)rep.size(), ret);
- int ret = c->call(24, i, rep, rpcc::to(3000));
+ int ret = c->call_timeout(24, rpcc::to(3000), rep, i);
- 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)
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;
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);
// specify a timeout value to an RPC that should succeed (tcp)
{
std::string arg(1000, 'x');
std::string rep;
// specify a timeout value to an RPC that should succeed (tcp)
{
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");
- intret = c->call(22, big, (std::string)"z", rep);
+ intret = c->call(22, rep, big, (std::string)"z");
- 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(intret == rpc_const::oldsrv_failure);
printf(" -- call recovered server with old client .. failed ok\n");
- intret = client->call(22, (std::string)"hello", (std::string)" goodbye", rep);
+ intret = client->call(22, rep, (std::string)"hello", (std::string)" goodbye");