wangzhengquan
2020-10-20 9b29a67af93e4ab9948cc60f743d73c4bb39e738
update
1个文件已修改
21 ■■■■■ 已修改文件
src/socket/net_mod_socket.c 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/socket/net_mod_socket.c
@@ -447,22 +447,24 @@
  int max_buf_size, buf_size;
 
  net_mod_request_head_t request_head;
  char portstr[32];
  int nsuc = 0;
  buf = (char *)malloc(MAXBUF);
  max_buf_size = MAXBUF;
  if(buf == NULL) {
  if((buf = (char *)malloc(MAXBUF)) == NULL) {
    LoggerFactory::getLogger()->error(errno, "NetModSocket::sendandrecv malloc");
    exit(1);
  } else {
     max_buf_size = MAXBUF;
  }
  int nsuc = 0;
  for (i = 0; i< arrlen; i++) {
    node = &node_arr[i];
    if(node->host == NULL) {
      // 本地发送
      shmModSocket.pub(topic, topic_size, content, content_size, node->key);
      if(shmModSocket.pub(topic, topic_size, content, content_size, node->key) == 0 ) {
         nsuc++;
      }
     
    } else {
      sprintf(portstr, "%d", node->port);
@@ -493,12 +495,13 @@
 
      if(rio_writen(clientfd, buf, buf_size) != buf_size ) {
        LoggerFactory::getLogger()->error(errno, "NetModSocket::pub rio_writen conent ");
        close(clientfd);
        continue;
      } else {
        nsuc++;
      }
      close(clientfd);
    }
    nsuc++;
  }
  free(buf);