From aa2f3b2a9968bb4928463bdae05fb026d16b60bb Mon Sep 17 00:00:00 2001 From: wangzhengquan <wangzhengquan85@126.com> Date: 星期五, 04 十二月 2020 19:07:01 +0800 Subject: [PATCH] 固定bus key --- src/socket/net_mod_socket.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/socket/net_mod_socket.c b/src/socket/net_mod_socket.c index f4259eb..07438fc 100644 --- a/src/socket/net_mod_socket.c +++ b/src/socket/net_mod_socket.c @@ -66,7 +66,7 @@ } /* One-time key creation function */ -void NetModSocket::_createKey_(void) +void NetModSocket::_createConnPoolKey_(void) { int ret; @@ -98,7 +98,7 @@ NetConnPool *mpool; /* Make first caller allocate key for thread-specific data */ - ret = pthread_once(&once, _createKey_); + ret = pthread_once(&once, _createConnPoolKey_); if (ret != 0) { LoggerFactory::getLogger()->error(errno, "NetModSocket::_sendandrecv_ pthread_once"); exit(1); @@ -107,8 +107,8 @@ mpool = (NetConnPool *)pthread_getspecific(poolKey); if (mpool == NULL) { - /* If first call from this thread, allocate - buffer for thread, and save its location */ + /* If first call from this thread, allocate buffer for thread, and save its location */ + logger->debug("Create connPool"); mpool = new NetConnPool(); if (mpool == NULL) { LoggerFactory::getLogger()->error(errno, "NetModSocket::_sendandrecv_ malloc"); @@ -264,7 +264,7 @@ NetConnPool *mpool; /* Make first caller allocate key for thread-specific data */ - ret = pthread_once(&once, _createKey_); + ret = pthread_once(&once, _createConnPoolKey_); if (ret != 0) { LoggerFactory::getLogger()->error(errno, "NetModSocket::_sendandrecv_ pthread_once"); exit(1); @@ -303,6 +303,7 @@ continue; } request_head.mod = BUS; + memcpy(request_head.host, node->host, sizeof(request_head.host)); request_head.key = node->key; request_head.content_length = content_size; request_head.topic_length = strlen(topic) + 1; -- Gitblit v1.8.0