X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/130f2d53438eb6193accb445aca52fa8e2fe4158..4b9798f44ae94deabf87dd534337b55259272950:/rpc/rpctest.cc diff --git a/rpc/rpctest.cc b/rpc/rpctest.cc index c43a9da..8aed748 100644 --- a/rpc/rpctest.cc +++ b/rpc/rpctest.cc @@ -24,10 +24,10 @@ int port; // from multiple classes. class srv { public: - 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); }; // a handler. a and b are arguments, r is the result. @@ -38,21 +38,21 @@ class srv { // at these argument types, so this function definition // does what a .x file does in SunRPC. int -srv::handle_22(const std::string a, std::string b, std::string &r) +srv::handle_22(std::string &r, const std::string a, std::string b) { r = a + b; return 0; } int -srv::handle_fast(const int a, int &r) +srv::handle_fast(int &r, const int a) { r = a + 1; return 0; } int -srv::handle_slow(const int a, int &r) +srv::handle_slow(int &r, const int a) { usleep(random() % 5000); r = a + 2; @@ -60,7 +60,7 @@ srv::handle_slow(const int a, int &r) } int -srv::handle_bigrep(const int len, std::string &r) +srv::handle_bigrep(std::string &r, const int len) { r = std::string(len, 'x'); return 0; @@ -71,10 +71,10 @@ srv service; void startserver() { server = new rpcs(port); - 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); } void