More dependency check-ups
[invirt/third/libt4.git] / rpc / rpctest.cc
index 7217b25..b90d19a 100644 (file)
@@ -80,8 +80,8 @@ testmarshall()
 {
     marshall m;
     request_header rh{1,2,3,4,5};
-    m.pack_req_header(rh);
-    VERIFY(m.size()==RPC_HEADER_SZ);
+    m.pack_header(rh);
+    VERIFY(((string)m).size()==RPC_HEADER_SZ);
     int i = 12345;
     unsigned long long l = 1223344455L;
     string s = "hallo....";
@@ -89,14 +89,12 @@ testmarshall()
     m << l;
     m << s;
 
-    char *b;
-    size_t sz;
-    m.take_buf(&b,&sz);
-    VERIFY(sz == RPC_HEADER_SZ+sizeof(i)+sizeof(l)+s.size()+sizeof(int));
+    string b = m;
+    VERIFY(b.size() == RPC_HEADER_SZ+sizeof(i)+sizeof(l)+s.size()+sizeof(int));
 
-    unmarshall un(b,sz);
+    unmarshall un(b, true);
     request_header rh1;
-    un.unpack_req_header(&rh1);
+    un.unpack_header(rh1);
     VERIFY(memcmp(&rh,&rh1,sizeof(rh))==0);
     int i1;
     unsigned long long l1;
@@ -131,11 +129,11 @@ client1(size_t cl)
         int arg = (random() % 1000);
         int rep;
 
-        auto start = std::chrono::steady_clock::now();
+        auto start = steady_clock::now();
 
         int ret = clients[which_cl]->call(which ? 23 : 24, rep, arg);
-        auto end = std::chrono::steady_clock::now();
-        auto diff = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
+        auto end = steady_clock::now();
+        auto diff = duration_cast<milliseconds>(end - start).count();
         if (ret != 0)
             cout << diff << " ms have elapsed!!!" << endl;
         VERIFY(ret == 0);
@@ -401,7 +399,7 @@ main(int argc, char *argv[])
 
     if (isclient) {
         // server's address.
-        dst = "127.0.0.1:" + std::to_string(port);
+        dst = "127.0.0.1:" + to_string(port);
 
 
         // start the client.  bind it to the server.