#include <getopt.h>
#include <unistd.h>
#include <string.h>
+#include "threaded_log.h"
#define NUM_CL 2
-char log_thread_prefix = 'r';
-
static rpcs *server; // server rpc object
static rpcc *clients[NUM_CL]; // client rpc object
static string dst; //server's ip address
static in_port_t port;
+using std::cout;
+using std::endl;
+using namespace std::chrono;
+using std::vector;
+
// server-side handlers. they must be methods of some class
// to simplify rpcs::reg(). a server process can have handlers
// from multiple classes.
static void testmarshall() {
marshall m;
rpc_protocol::request_header rh{1,2,3,4,5};
- m.pack_header(rh);
+ m.write_header(rh);
VERIFY(((string)m).size()==rpc_protocol::RPC_HEADER_SZ);
int i = 12345;
unsigned long long l = 1223344455L;
unmarshall un(b, true);
rpc_protocol::request_header rh1;
- un.unpack_header(rh1);
+ un.read_header(rh1);
VERIFY(memcmp(&rh,&rh1,sizeof(rh))==0);
int i1;
unsigned long long l1;
for(int i = 0; i < 100; i++){
int which = (random() % 2);
int arg = (random() % 1000);
- int rep;
+ int rep = -1;
auto start = steady_clock::now();
}
int main(int argc, char *argv[]) {
+ global = new t4_state('r');
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);
if (isclient) {
// server's address.
- dst = "127.0.0.1:" + to_string(port);
+ dst = "127.0.0.1:" + std::to_string(port);
// start the client. bind it to the server.