From d26327b3cde043a9470dcd7fea8e704ea517fdae Mon Sep 17 00:00:00 2001 From: lichao <lichao@aiotlink.com> Date: 星期四, 01 四月 2021 19:26:57 +0800 Subject: [PATCH] add req/rep center; --- src/pubsub.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/pubsub.h b/src/pubsub.h index cad9f61..ac5a9d2 100644 --- a/src/pubsub.h +++ b/src/pubsub.h @@ -50,9 +50,11 @@ Socket(shm, 64) {} SocketSubscribe() : SocketSubscribe(BHomeShm()) {} + ~SocketSubscribe() { Stop(); } typedef std::function<void(const std::string &topic, const std::string &data)> TopicDataCB; bool StartRecv(const TopicDataCB &tdcb, int nworker = 2); + bool Stop() { return Socket::Stop(); } bool Subscribe(const std::vector<std::string> &topics, const int timeout_ms); bool RecvSub(std::string &topic, std::string &data, const int timeout_ms); }; -- Gitblit v1.8.0