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/net/net_mod_socket.h | 22 +++++++++++++--------- 1 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/net/net_mod_socket.h b/src/net/net_mod_socket.h index d8e53ae..9d9af97 100644 --- a/src/net/net_mod_socket.h +++ b/src/net/net_mod_socket.h @@ -71,7 +71,8 @@ private: ShmModSocket shmModSocket; - + int int_val; + int svr_val; // pthread_mutex_t sendMutex; // request header 缂栫爜涓虹綉缁滀紶杈撶殑瀛楄妭 @@ -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 鍙戦�佺粰璋� -- Gitblit v1.8.0