From 26ed48c4e616014ee760fd13d13dbdc8539c34e3 Mon Sep 17 00:00:00 2001 From: wangzhengquan <wangzhengquan85@126.com> Date: 星期二, 22 十二月 2020 19:21:55 +0800 Subject: [PATCH] 解决sendandrecv发送到一个不存在key的情况 --- src/socket/shm_mod_socket.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/socket/shm_mod_socket.c b/src/socket/shm_mod_socket.c index e28f872..4c3938e 100644 --- a/src/socket/shm_mod_socket.c +++ b/src/socket/shm_mod_socket.c @@ -236,7 +236,6 @@ memcpy(head.action, "desub", sizeof(head.action)); head.topic_size = topic_size = strlen(topic) + 1; head.content_size = 0; - void *buf; int size = get_bus_sendbuf(head, topic, topic_size, NULL, 0, &buf); if(size > 0) { @@ -328,7 +327,7 @@ memcpy(tmp_ptr, head.action, sizeof(head.action)); - tmp_ptr += 4; + tmp_ptr += sizeof(head.action); PUT(tmp_ptr, htonl(head.topic_size)); tmp_ptr += 4; @@ -343,12 +342,11 @@ memcpy(head.action, tmp_ptr, sizeof(head.action)); - tmp_ptr += 4; + tmp_ptr += sizeof(head.action); head.topic_size = ntohl(GET(tmp_ptr)); tmp_ptr += 4; head.content_size = ntohl(GET(tmp_ptr)); - return head; } -- Gitblit v1.8.0