From 0c4748cdeb4b9f4c36f4222ccc1652d4d486cb0c Mon Sep 17 00:00:00 2001
From: wangzhengquan <wangzhengquan85@126.com>
Date: 星期三, 02 十二月 2020 11:07:31 +0800
Subject: [PATCH] uddate

---
 src/socket/net_mod_socket.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/socket/net_mod_socket.c b/src/socket/net_mod_socket.c
index a3d4543..b0b939f 100644
--- a/src/socket/net_mod_socket.c
+++ b/src/socket/net_mod_socket.c
@@ -15,7 +15,8 @@
 
 NetModSocket::NetModSocket() 
 {
-  if (Signal(SIGPIPE, SIG_IGN) == SIG_ERR)    err_msg(errno, "signal");
+  if (Signal(SIGPIPE, SIG_IGN) == SIG_ERR)
+      logger->error(errno, "NetModSocket::NetModSocket signal");
 }
 
 
@@ -56,21 +57,23 @@
 
 
 /* Free thread-specific data buffer */
-void NetModSocket::_destructor_(void *_pool)
+void NetModSocket::_destroyConnPool_(void *_pool)
 {
+
   NetConnPool *mpool = (NetConnPool *)_pool;
   delete mpool;
+  logger->debug("destory connPool");
 }
 
  /* One-time key creation function */
-void NetModSocket::_createKey_(void)
+void NetModSocket::_createConnPoolKey_(void)
 {
   int ret;
 
   /* Allocate a unique thread-specific data key and save the address
      of the destructor for thread-specific data buffers */
 
-  ret = pthread_key_create(&poolKey, _destructor_);
+  ret = pthread_key_create(&poolKey, _destroyConnPool_);
   if (ret != 0) {
     logger->error(ret, "pthread_key_create");
     exit(1);
@@ -83,8 +86,6 @@
   int i, n, recv_size, connfd;
   net_node_t *node;
   void *recv_buf;
-
- 
   
   net_mod_request_head_t request_head = {};
  
@@ -97,8 +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);
@@ -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