From 578e15c276d72bfbdd707c6c948824daa43d3780 Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期四, 18 一月 2024 14:18:35 +0800
Subject: [PATCH] less memory
---
src/socket/bus_server_socket.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/src/socket/bus_server_socket.h b/src/socket/bus_server_socket.h
index 3052c8b..4cd0140 100644
--- a/src/socket/bus_server_socket.h
+++ b/src/socket/bus_server_socket.h
@@ -8,6 +8,7 @@
#include "sem_util.h"
#include "logger_factory.h"
#include "key_def.h"
+#include "msg_mgr.h"
#include "socket_def.h"
#include <set>
@@ -18,12 +19,51 @@
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;
+typedef struct _LinkNode
+{
+ int data;
+ int data_fix;
+ int count;
+
+ _LinkNode *next;
+} LinkNode;
+
+class list
+{
+
+private:
+
+ LinkNode *head;
+
+public:
+
+ list() {head = NULL;};
+
+ void Insert(int aDate, int bDate);
+
+ void Delete(int Data);
+
+ int dataFixGet(int data);
+
+ int dataGet(int data);
+
+ void dataSet(int data, int val);
+
+ int NodeNum(void);
+
+ int nodeGet(int index);
+
+ LinkNode *getHead() {return head;};
+
+};
+
class BusServerSocket {
private:
shm_socket_t *shm_socket;
// pthread_t recv_thread;
// <涓婚锛� 璁㈤槄鑰�>
SHMTopicSubMap *topic_sub_map;
+ recvbuf_data recvBuf_data;
private:
int destroy();
@@ -66,6 +106,7 @@
* @return 0 鎴愬姛锛� 鍏朵粬鍊� 澶辫触鐨勯敊璇爜
*/
int start();
+ int get_data(int val);
/**
* 鍋滄bus
@@ -73,14 +114,18 @@
* @return 0 鎴愬姛锛� 鍏朵粬鍊� 澶辫触鐨勯敊璇爜
*/
int stop();
-
-
+ int check_proc(int val, const void *buf, int len, void **buf_ret, int *len_ret, \
+ const struct timespec *timeout, const int flag);
+ void remove_proc(int val);
/**
* 鑾峰彇soket key
*/
int get_key() ;
+ void _data_remove(int val);
+ void buf_data_set(int data, int val);
+ void buf_data_remove(int data);
};
--
Gitblit v1.8.0