From 7b84c595bb128d0ae72555b4e8f93df516499584 Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期五, 21 五月 2021 16:10:24 +0800
Subject: [PATCH] fix api test get error.

---
 src/topic_node.cpp |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/topic_node.cpp b/src/topic_node.cpp
index fce7ed6..124d329 100644
--- a/src/topic_node.cpp
+++ b/src/topic_node.cpp
@@ -143,8 +143,14 @@
 	for (auto &p : sockets_) { p->Stop(); }
 }
 
-bool TopicNode::Register(ProcInfo &proc, MsgCommonReply &reply_body, const int timeout_ms)
+bool TopicNode::UniRegister(const bool internal, ProcInfo &proc, MsgCommonReply &reply_body, const int timeout_ms)
 {
+	auto ValidUserProcId = [](const std::string &id) { return !id.empty() && id[0] != '#'; };
+	if (!internal && !ValidUserProcId(proc.proc_id())) {
+		SetLastError(eInvalidInput, "invalid proc id :'" + proc.proc_id() + "'");
+		return false;
+	}
+
 	{
 		std::lock_guard<std::mutex> lk(mutex_);
 		info_ = proc;

--
Gitblit v1.8.0