From c6964d5af25d4ec7ed9dbe7674dc4e3896b36ead Mon Sep 17 00:00:00 2001 From: lichao <lichao@aiotlink.com> Date: 星期五, 16 四月 2021 16:10:02 +0800 Subject: [PATCH] node remove mq if never registered; refactor. --- src/defs.cpp | 31 +++++++++++++++++++++++++++---- 1 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/defs.cpp b/src/defs.cpp index 4051196..77b0722 100644 --- a/src/defs.cpp +++ b/src/defs.cpp @@ -20,11 +20,34 @@ { const MQId kBHTopicBus = boost::uuids::string_generator()("01234567-89ab-cdef-8349-1234567890ff"); -const MQId kBHTopicReqRepCenter = boost::uuids::string_generator()("12345670-89ab-cdef-8349-1234567890ff"); +const MQId kBHTopicCenter = boost::uuids::string_generator()("12345670-89ab-cdef-8349-1234567890ff"); const MQId kBHUniCenter = boost::uuids::string_generator()("87654321-89ab-cdef-8349-1234567890ff"); + +struct LastError { + int ec_ = 0; + std::string msg_; +}; + +LastError &LastErrorStore() +{ + thread_local LastError le; + return le; +} } // namespace -const MQId &BHTopicBus() { return kBHTopicBus; } -const MQId &BHTopicReqRepCenter() { return kBHTopicReqRepCenter; } -const MQId &BHUniCenter() { return kBHUniCenter; } +const MQId &BHTopicBusAddress() { return kBHTopicBus; } +const MQId &BHTopicCenterAddress() { return kBHTopicCenter; } +const MQId &BHUniCenterAddress() { return kBHUniCenter; } + +void SetLastError(const int ec, const std::string &msg) +{ + LastErrorStore().ec_ = ec; + LastErrorStore().msg_ = msg; +} + +void GetLastError(int &ec, std::string &msg) +{ + ec = LastErrorStore().ec_; + msg = LastErrorStore().msg_; +} \ No newline at end of file -- Gitblit v1.8.0