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 | 37 ++++++++++++++++++++-----------------
1 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/src/net/net_mod_socket.h b/src/net/net_mod_socket.h
index 6289fa6..a7619f5 100644
--- a/src/net/net_mod_socket.h
+++ b/src/net/net_mod_socket.h
@@ -3,6 +3,7 @@
#include "usg_common.h"
#include "shm_mod_socket.h"
#include "socket_io.h"
+#include "proc_def.h"
#include <poll.h>
#include "socket_def.h"
#include "net_conn_pool.h"
@@ -17,7 +18,7 @@
int key;
};
-#define NET_MODE_REQUEST_HEAD_LENGTH (NI_MAXHOST + 6 * sizeof(uint32_t))
+#define NET_MODE_REQUEST_HEAD_LENGTH sizeof(net_mod_request_head_t)
// 璇锋眰澶�
@@ -70,7 +71,9 @@
private:
ShmModSocket shmModSocket;
-
+ int int_val;
+ int svr_val;
+ std::map<std::string, int> recvbuf;
// pthread_mutex_t sendMutex;
// request header 缂栫爜涓虹綉缁滀紶杈撶殑瀛楄妭
@@ -118,8 +121,7 @@
*/
int force_bind( int key);
-
-
+ int reg(void *pData, int len, void **buf, int *size, const int timeout_ms, int flag);
/**
* 濡傛灉寤虹珛杩炴帴鐨勮妭鐐规病鏈夋帴鍙楀埌娑堟伅绛夊緟timeout鐨勬椂闂村悗杩斿洖
@@ -135,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
* 浼樼偣锛氱嚎绋嬪畨鍏�
@@ -145,27 +150,26 @@
// 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);
/**
* 鏈湴鍙戦�佽姹備俊鎭苟绛夊緟鎺ユ敹搴旂瓟
@@ -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