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/net/net_mod_socket.h | 33 ++++++++++++++++++---------------
1 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/src/net/net_mod_socket.h b/src/net/net_mod_socket.h
index d8e53ae..a7619f5 100644
--- a/src/net/net_mod_socket.h
+++ b/src/net/net_mod_socket.h
@@ -71,7 +71,9 @@
private:
ShmModSocket shmModSocket;
-
+ int int_val;
+ int svr_val;
+ std::map<std::string, int> recvbuf;
// pthread_mutex_t sendMutex;
// request header 缂栫爜涓虹綉缁滀紶杈撶殑瀛楄妭
@@ -119,7 +121,6 @@
*/
int force_bind( int key);
- int bind_proc_id(char *buf, int len);
int reg(void *pData, int len, void **buf, int *size, const int timeout_ms, int flag);
/**
@@ -136,7 +137,10 @@
net_mod_recv_msg_t ** recv_arr, int *recv_arr_size,
net_mod_err_t ** _err_arr, int *_err_arr_size, int timeout);
-
+ void int_set(int data);
+ void svr_set(int data);
+ int int_get(void);
+ int svr_get(void);
/**
* 鍔熻兘鍚宻endandrecv
* 浼樼偣锛氱嚎绋嬪畨鍏�
@@ -146,27 +150,27 @@
// int sendandrecv_safe(net_node_t *node_arr, int node_arr_len, void *send_buf, int send_size,
// net_mod_recv_msg_t ** recv_arr, int *recv_arr_size);
-
/**
* 鍙戦�佷俊鎭�
* @key 鍙戦�佺粰璋�
* @return 0 鎴愬姛锛� 鍏朵粬鍊� 澶辫触鐨勯敊璇爜
*/
- int sendto( const void *buf, const int size, const int key);
+ int sendto( const void *buf, const int size, const int key, int reset = 0, int data_set = 0);
// 鍙戦�佷俊鎭秴鏃惰繑鍥炪�� @sec 绉� 锛� @nsec 绾崇
- int sendto_timeout( const void *buf, const int size, const int key, int sec, int nsec);
+ int sendto_timeout( const void *buf, const int size, const int key, int sec, int nsec, int reset = 0, int data_set = 0);
// 鍙戦�佷俊鎭珛鍒昏繑鍥炪��
- int sendto_nowait( const void *buf, const int size, const int key);
+ int sendto_nowait( const void *buf, const int size, const int key, int reset = 0, int data_set = 0);
/**
* 鎺ユ敹淇℃伅
* @key 浠庤皝鍝噷鏀跺埌鐨勪俊鎭�
* @return 0 鎴愬姛锛� 鍏朵粬鍊� 澶辫触鐨勯敊璇爜
*/
- int recvfrom( void **buf, int *size, int *key);
+ int recvfrom( void **buf, int *size, int *key, int reset = 0, int data_set = 0);
// 鎺ュ彈淇℃伅瓒呮椂杩斿洖銆� @sec 绉� 锛� @nsec 绾崇
- int recvfrom_timeout( void **buf, int *size, int *key, int sec, int nsec);
- int recvfrom_nowait( void **buf, int *size, int *key);
+ int recvfrom_timeout( void **buf, int *size, int *key, int sec, int nsec, int reset = 0, int data_set = 0);
+ int recvfrom_nowait( void **buf, int *size, int *key, int reset = 0, int data_set = 0);
+
/**
* 鏈湴鍙戦�佽姹備俊鎭苟绛夊緟鎺ユ敹搴旂瓟
* @key 鍙戦�佺粰璋�
@@ -176,9 +180,6 @@
// 瓒呮椂杩斿洖銆� @sec 绉� 锛� @nsec 绾崇
int sendandrecv_timeout( const void *send_buf, const int send_size, const int send_key, void **recv_buf, int *recv_size, int sec, int nsec) ;
int sendandrecv_nowait( const void *send_buf, const int send_size, const int send_key, void **recv_buf, int *recv_size) ;
-
-
-
/**
* recvandsend
@@ -247,7 +248,9 @@
*/
static void free_recv_msg_arr(net_mod_recv_msg_t * arr, size_t size);
-
+ void buf_data_set(std::string str, int val);
+ int buf_data_get(std::string str);
+ void buf_data_del(std::string str);
};
-#endif
\ No newline at end of file
+#endif
--
Gitblit v1.8.0