From e782ad440171cc5e68c987352e3470b1a4234683 Mon Sep 17 00:00:00 2001
From: wangzhengquan <wangzhengquan85@126.com>
Date: 星期四, 04 二月 2021 18:41:52 +0800
Subject: [PATCH] update
---
src/socket/shm_mod_socket.cpp | 24 +++++++++++++++++++-----
1 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/src/socket/shm_mod_socket.cpp b/src/socket/shm_mod_socket.cpp
index aa02ef3..f5bd0b7 100644
--- a/src/socket/shm_mod_socket.cpp
+++ b/src/socket/shm_mod_socket.cpp
@@ -79,7 +79,21 @@
*/
int ShmModSocket::sendandrecv(const void *send_buf, const int send_size, const int send_key,
void **recv_buf, int *recv_size, const struct timespec *timeout, int flag){
- return shm_sendandrecv(shm_socket, send_buf, send_size, send_key, recv_buf, recv_size, timeout, flag);
+ int rv = shm_sendandrecv(shm_socket, send_buf, send_size, send_key, recv_buf, recv_size, timeout, flag);
+
+ if(rv == 0) {
+ logger->debug("ShmModSocket::sendandrecv: sendandrecv to %d success.\n", send_key);
+ return 0;
+ }
+
+ logger->debug("ShmModSocket::sendandrecv : sendandrecv to %d failed %s", send_key, bus_strerror(rv));
+ return rv;
+}
+
+
+int ShmModSocket::recvandsend( recvandsend_callback_fn callback,
+ const struct timespec *timeout , int flag, void * user_data ) {
+ return shm_recvandsend(shm_socket, callback, timeout, flag, user_data);
}
// // 瓒呮椂杩斿洖銆� @sec 绉� 锛� @nsec 绾崇
@@ -94,7 +108,7 @@
* @size 涓婚闀垮害
* @key 鎬荤嚎绔彛
*/
-int ShmModSocket::sub(char *topic, int topic_size, int key,
+int ShmModSocket::sub(const char *topic, int topic_size, int key,
const struct timespec *timeout, int flags) {
int ret;
bus_head_t head = {};
@@ -125,7 +139,7 @@
* @size 涓婚闀垮害
* @key 鎬荤嚎绔彛
*/
-int ShmModSocket::desub(char *topic, int topic_size, int key, const struct timespec *timeout, int flags) {
+int ShmModSocket::desub(const char *topic, int topic_size, int key, const struct timespec *timeout, int flags) {
// char buf[8192];
int ret;
if(topic == NULL) {
@@ -163,7 +177,7 @@
* @content 涓婚鍐呭
* @key 鎬荤嚎绔彛
*/
-int ShmModSocket::pub(char *topic, int topic_size, void *content, int content_size, int key, const struct timespec *timeout, int flags) {
+int ShmModSocket::pub(const char *topic, int topic_size, const void *content, int content_size, int key, const struct timespec *timeout, int flags) {
int ret;
bus_head_t head = {};
memcpy(head.action, "pub", sizeof(head.action));
@@ -196,7 +210,7 @@
// =============================================================================
int ShmModSocket::get_bus_sendbuf(bus_head_t &request_head,
- void *topic_buf, int topic_size, void *content_buf, int content_size, void **retbuf) {
+ const void *topic_buf, int topic_size, const void *content_buf, int content_size, void **retbuf) {
int buf_size;
char *buf;
--
Gitblit v1.8.0