From 9b9220321e647b381a999f67cad12345334b2cbe Mon Sep 17 00:00:00 2001
From: wangzhengquan <wangzhengquan85@126.com>
Date: 星期四, 06 八月 2020 13:06:23 +0800
Subject: [PATCH] update

---
 src/socket/include/dmod_socket.h |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/src/socket/include/dmod_socket.h b/src/socket/include/dmod_socket.h
index 5e97e2a..8eb0fbf 100644
--- a/src/socket/include/dmod_socket.h
+++ b/src/socket/include/dmod_socket.h
@@ -38,6 +38,7 @@
   // pthread_t recv_thread;
   // <涓婚锛� 璁㈤槄鑰�>
 	SHMTopicSubMap *topic_sub_map;
+	std::set<int> *bus_set;
 
 private:
 	inline int _recvfrom_(void **buf, int *size, int *port,  struct timespec *timeout, int flags);
@@ -48,7 +49,15 @@
 	int _sub_( void *topic, int size, int port, struct timespec *timeout, int flags);
 	int _pub_( void *topic, int topic_size, void *content, int content_size, int port, struct timespec *timeout, int flags);
 
-	static void  foreach_subscripters(std::function<void(SHMKeySet *, SHMKeySet::iterator)>  cb) ;
+	void _proxy_desub( char *topic, int port);
+	void _proxy_desub_all(int port);
+	int  _desub_( void *topic, int size, int port, struct timespec *timeout, int flags);
+
+	static void foreach_subscripters(std::function<void(SHMKeySet *, SHMKeySet::iterator)>  cb);
+	static bool include_in_keys(int key, int keys[], size_t length);
+	static size_t remove_subscripters(int keys[], size_t length) ;
+public:
+	static size_t remove_keys(int keys[], size_t length);
 public:
 	DModSocket();
 	~DModSocket();
@@ -116,6 +125,16 @@
 	int  sub_nowait(void *topic, int size, int port);
 
 
+	 /**
+	 * 鍙栨秷璁㈤槄鎸囧畾涓婚
+	 * @topic 涓婚
+	 * @size 涓婚闀垮害
+	 * @port 鎬荤嚎绔彛
+	 */
+	int desub( void *topic, int size, int port);
+	// 瓒呮椂杩斿洖銆� @sec 绉� 锛� @nsec 绾崇
+	int desub_timeout(void *topic, int size, int port, struct timespec *timeout);
+	int desub_nowait(void *topic, int size, int port) ;
 
 	/**
 	 * 鍙戝竷涓婚
@@ -133,6 +152,8 @@
 	 * 鑾峰彇soket绔彛鍙�
 	 */
 	int get_port() ;
+
+
 };
 
 #endif
\ No newline at end of file

--
Gitblit v1.8.0