From 12398aa45630c89914b05952c208e43d71b4d736 Mon Sep 17 00:00:00 2001
From: wangzhengquan <wangzhengquan85@126.com>
Date: 星期四, 17 十二月 2020 11:55:42 +0800
Subject: [PATCH] 本地node host 为空串

---
 src/socket/net_mod_socket.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/socket/net_mod_socket.c b/src/socket/net_mod_socket.c
index 771551f..3eb7077 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");
@@ -129,10 +129,10 @@
   for (i = 0; i< arrlen; i++) {
 
     node = &node_arr[i];
-    if(node->host == NULL) {
+    if(node->host == NULL || strcmp(node->host, "") == 0 ) {
       // 鏈湴鍙戦��
       shmModSocket.sendandrecv(send_buf, send_size, node->key, &recv_buf, &recv_size);
-      strcpy( ret_arr[n_recv_suc].host,"localshm");
+      strcpy( ret_arr[n_recv_suc].host,"");
       ret_arr[n_recv_suc].port = 0;
       ret_arr[n_recv_suc].key = node->key;
       ret_arr[n_recv_suc].content = recv_buf;
@@ -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);

--
Gitblit v1.8.0