From 11f6c600e55ca5677f93624efe44d2605cdd908d Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期五, 21 五月 2021 20:18:38 +0800
Subject: [PATCH] reserve #,@ prefix for internal proc id and topic.

---
 utest/api_test.cpp |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/utest/api_test.cpp b/utest/api_test.cpp
index 7081435..3d842bf 100644
--- a/utest/api_test.cpp
+++ b/utest/api_test.cpp
@@ -176,8 +176,21 @@
 		int reply_len = 0;
 		bool r = BHRegisterTopics(s.data(), s.size(), &reply, &reply_len, 1000);
 		DEFER1(BHFree(reply, reply_len));
-		// printf("register topic : %s\n", r ? "ok" : "failed");
-		// Sleep(1s);
+	}
+	{ // Server Register Topics
+		MsgTopicList topics;
+		topics.add_topic_list("@should_fail");
+		std::string s = topics.SerializeAsString();
+		void *reply = 0;
+		int reply_len = 0;
+		bool r = BHRegisterTopics(s.data(), s.size(), &reply, &reply_len, 1000);
+		DEFER1(BHFree(reply, reply_len));
+		if (!r) {
+			int ec = 0;
+			std::string msg;
+			GetApiError(ec, msg);
+			printf("register rpc failed, %d, %s\n", ec, msg.c_str());
+		}
 	}
 	auto PrintProcs = [](MsgQueryProcReply const &result) {
 		printf("query proc result: %d\n", result.proc_list().size());
@@ -214,7 +227,7 @@
 	{
 		// query procs with normal topic request
 		MsgRequestTopic req;
-		req.set_topic("@center_query_procs");
+		req.set_topic("#center_query_procs");
 		// req.set_data("{\"proc_id\":\"#center.node\"}");
 		std::string s(req.SerializeAsString());
 		// Sleep(10ms, false);

--
Gitblit v1.8.0