From dc01e4cbb01e96d19b470a366bbe648d426ed171 Mon Sep 17 00:00:00 2001 From: fujuntang <fujuntang@smartai.com> Date: 星期六, 11 九月 2021 10:06:15 +0800 Subject: [PATCH] Add topics sub and request support. --- src/socket/bus_server_socket.h | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/socket/bus_server_socket.h b/src/socket/bus_server_socket.h index 1a83d0e..e60c700 100644 --- a/src/socket/bus_server_socket.h +++ b/src/socket/bus_server_socket.h @@ -3,7 +3,7 @@ #include "usg_common.h" #include "shm_socket.h" #include "shm_allocator.h" -#include "mem_pool.h" +#include "shm_mm.h" #include "hashtable.h" #include "sem_util.h" #include "logger_factory.h" @@ -18,7 +18,6 @@ typedef std::set<int, std::less<int>, SHM_STL_Allocator<int> > SHMKeySet; typedef std::map<SHMString, SHMKeySet *, std::less<SHMString>, SHM_STL_Allocator<std::pair<const SHMString, SHMKeySet *> > > SHMTopicSubMap; - class BusServerSocket { private: shm_socket_t *shm_socket; @@ -27,15 +26,18 @@ SHMTopicSubMap *topic_sub_map; private: + int destroy(); void _proxy_sub( char *topic, int key); - void _proxy_pub( char *topic, size_t head_len, void *buf, size_t size, int key); - void *run_pubsub_proxy(); - int parse_pubsub_topic(char *str, size_t size, char **_action, char **_topic, size_t *head_len ); - + void _proxy_pub( char *topic, char *buf, size_t size, int key); + int _run_proxy_(); + // int parse_pubsub_topic(char *str, size_t size, char **_action, char **_topic, size_t *head_len ); + void _proxy_desub( char *topic, int key); void _proxy_desub_all(int key); - static void foreach_subscripters(std::function<void(SHMKeySet *, int)> cb); + void _proxy_reg(const char *topic, size_t topic_size, const char *content, size_t content_size, int key, int flag); + + static void foreach_subscripters(std::function<void(SHMKeySet *, int)> cb); // static bool include_in_keys(int key, int keys[], size_t length); public: @@ -79,6 +81,7 @@ */ int get_key() ; + void _data_remove(int val1, int val2); }; -- Gitblit v1.8.0