From ca319178f45ce6256aed7913565d445571f6db22 Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期二, 20 四月 2021 11:04:07 +0800
Subject: [PATCH] add go api, wrap C api, not finished.

---
 utest/utest.cpp |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/utest/utest.cpp b/utest/utest.cpp
index 12d4396..572d8e5 100644
--- a/utest/utest.cpp
+++ b/utest/utest.cpp
@@ -198,7 +198,7 @@
 {
 	const std::string shm_name("ShmReqRep");
 	ShmRemover auto_remove(shm_name);
-	SharedMemory shm(shm_name, 1024 * 1024 * 50);
+	SharedMemory shm(shm_name, 1024 * 1024 * 512);
 
 	auto Avail = [&]() { return shm.get_free_memory(); };
 	auto init_avail = Avail();
@@ -224,22 +224,24 @@
 				printf("count: %d\n", count.load());
 			}
 		};
+		MsgRequestTopic req;
+		req.set_topic(topic);
+		req.set_data("data " + std::string(100, 'a'));
 		client.ClientStartWorker(onRecv, 2);
 		boost::timer::auto_cpu_timer timer;
 		for (int i = 0; i < nreq; ++i) {
-			MsgRequestTopic req;
-			req.set_topic(topic);
-			req.set_data("data " + std::to_string(i));
 			std::string msg_id;
 			if (!client.ClientAsyncRequest(req, msg_id)) {
 				printf("client request failed\n");
 				++count;
 			}
 
-			// if (!client.SyncRequest(topic, "data " + std::to_string(i), reply, 1000)) {
+			// std::string proc_id;
+			// MsgRequestTopicReply reply;
+			// if (!client.ClientSyncRequest(req, proc_id, reply, 1000)) {
 			// 	printf("client request failed\n");
 			// }
-			// 	++count;
+			// ++count;
 		}
 		do {
 			std::this_thread::yield();
@@ -278,7 +280,7 @@
 	servers.Launch(Server, "server", topics);
 	Sleep(100ms);
 	for (auto &t : topics) {
-		clients.Launch(Client, t, 1000 * 100);
+		clients.Launch(Client, t, 1000 * 100 * 2);
 	}
 	clients.WaitAll();
 	printf("clients done, server replyed: %ld\n", server_msg_count.load());

--
Gitblit v1.8.0