REMOTE_PROCEDURE(23, fast, (int &, int));
REMOTE_PROCEDURE(24, slow, (int &, int));
REMOTE_PROCEDURE(25, bigrep, (string &, size_t));
-};
+}
// a handler. a and b are arguments, r is the result.
// there can be multiple arguments but only one result.
static srv service;
-void startserver() {
+static void startserver() {
server = new rpcs(port);
server->reg(srv_protocol::_22, &srv::handle_22, &service);
server->reg(srv_protocol::fast, &srv::handle_fast, &service);
server->start();
}
-void testmarshall() {
+static void testmarshall() {
marshall m;
rpc_protocol::request_header rh{1,2,3,4,5};
m.pack_header(rh);
unsigned long long l = 1223344455L;
size_t sz = 101010101;
string s = "hallo....";
+ string bin("\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x7f\xe5", 12);
m << i;
m << l;
m << s;
m << sz;
+ m << bin;
string b = m;
- VERIFY(b.size() == rpc_protocol::RPC_HEADER_SZ+sizeof(i)+sizeof(l)+s.size()+sizeof(int)+sizeof(uint32_t));
+ VERIFY(b.size() == rpc_protocol::RPC_HEADER_SZ+sizeof(i)+sizeof(l)+sizeof(uint32_t)+s.size()+sizeof(uint32_t)+sizeof(uint32_t)+bin.size());
unmarshall un(b, true);
rpc_protocol::request_header rh1;
int i1;
unsigned long long l1;
string s1;
+ string bin1;
size_t sz1;
un >> i1;
un >> l1;
un >> s1;
un >> sz1;
+ un >> bin1;
VERIFY(un.okdone());
- VERIFY(i1==i && l1==l && s1==s && sz1==sz);
+ VERIFY(i1==i && l1==l && s1==s && sz1==sz && bin1==bin);
}
-void client1(size_t cl) {
+static void client1(size_t cl) {
// test concurrency.
size_t which_cl = cl % NUM_CL;
}
}
-void client2(size_t cl) {
+static void client2(size_t cl) {
size_t which_cl = cl % NUM_CL;
time_t t1;
}
}
-void client3(void *xx) {
+static void client3(void *xx) {
rpcc *c = (rpcc *) xx;
for(int i = 0; i < 4; i++){
}
}
-void simple_tests(rpcc *c) {
+static void simple_tests(rpcc *c) {
cout << "simple_tests" << endl;
// an RPC call to procedure #22.
// rpcc::call() looks at the argument types to decide how
cout << "simple_tests OK" << endl;
}
-void concurrent_test(size_t nt) {
+static void concurrent_test(size_t nt) {
// create threads that make lots of calls in parallel,
// to test thread synchronization for concurrent calls
// and dispatches.
cout << " OK" << endl;
}
-void lossy_test() {
+static void lossy_test() {
cout << "start lossy_test ...";
VERIFY(setenv("RPC_LOSSY", "5", 1) == 0);
VERIFY(setenv("RPC_LOSSY", "0", 1) == 0);
}
-void failure_test() {
+static void failure_test() {
rpcc *client1;
rpcc *client = clients[0];