From 1b52f1cb8c47dd2c0195d2fd65d7b6a4c2f10704 Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期一, 12 四月 2021 18:29:41 +0800
Subject: [PATCH] add fail-resend support.

---
 utest/speed_test.cpp |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/utest/speed_test.cpp b/utest/speed_test.cpp
index b1f11ac..77c018a 100644
--- a/utest/speed_test.cpp
+++ b/utest/speed_test.cpp
@@ -26,7 +26,7 @@
 	ShmRemover auto_remove(shm_name);
 	const int mem_size = 1024 * 1024 * 50;
 	MQId id = boost::uuids::random_generator()();
-	const int timeout = 100;
+	const int timeout = 1000;
 	const uint32_t data_size = 4000;
 	const std::string proc_id = "demo_proc";
 
@@ -44,7 +44,6 @@
 		DEFER1(msg.Release(shm););
 
 		for (uint64_t i = 0; i < n; ++i) {
-			// mq.Send(id, str.data(), str.size(), timeout);
 			mq.Send(id, msg, timeout);
 		}
 	};
@@ -91,6 +90,7 @@
 					www.Launch(Writer, i, nmsg);
 				}
 				www.WaitAll();
+				printf("writer finished\n");
 				run.store(false);
 				rrr.WaitAll();
 				printf("Write %ld msg  R(%3d) W(%3d), : ", total_msg, nreader, nwriter);
@@ -136,14 +136,18 @@
 	req_body.set_topic("topic");
 	req_body.set_data(msg_content);
 	auto req_head(InitMsgHead(GetType(req_body), client_proc_id));
+	req_head.add_route()->set_mq_id(&cli.id(), cli.id().size());
 	request_rc.MakeRC(shm, req_head, req_body);
+	DEFER1(request_rc.Release(shm));
 
 	MsgRequestTopic reply_body;
 	reply_body.set_topic("topic");
 	reply_body.set_data(msg_content);
 	auto reply_head(InitMsgHead(GetType(reply_body), server_proc_id));
+	reply_head.add_route()->set_mq_id(&srv.id(), srv.id().size());
 	MsgI reply_rc;
 	reply_rc.MakeRC(shm, reply_head, reply_body);
+	DEFER1(reply_rc.Release(shm));
 
 	std::atomic<uint64_t> count(0);
 
@@ -224,9 +228,5 @@
 	printf("request ok: %ld\n", count.load());
 	stop = true;
 	servers.WaitAll();
-	BOOST_CHECK(request_rc.IsCounted());
-	BOOST_CHECK_EQUAL(request_rc.Count(), 1);
-	request_rc.Release(shm);
-	BOOST_CHECK(!request_rc.IsCounted());
 	// BOOST_CHECK_THROW(reply.Count(), int);
 }

--
Gitblit v1.8.0