From 4bdc8cbf42f3990c2854896b3e1f07de1e4ebb01 Mon Sep 17 00:00:00 2001
From: wangzhengquan <wangzhengquan85@126.com>
Date: 星期五, 16 十月 2020 20:10:18 +0800
Subject: [PATCH] update

---
 src/socket/net_mod_server_socket.c |   22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/src/socket/net_mod_server_socket.c b/src/socket/net_mod_server_socket.c
index f475b3a..ccc17e2 100644
--- a/src/socket/net_mod_server_socket.c
+++ b/src/socket/net_mod_server_socket.c
@@ -73,7 +73,7 @@
 {
   int i;
   pool.nready--;
-  for (i = 0; i < FD_SETSIZE; i++)  /* Find an available slot */
+  for (i = 0; i < FD_SETSIZE; i++)  {/* Find an available slot */
     if (pool.clientfd[i] < 0)
     {
       /* Add connected descriptor to the pool */
@@ -90,8 +90,12 @@
         pool.maxi = i;       //line:conc:echoservers:endmaxi
       break;
     }
-  if (i == FD_SETSIZE) /* Couldn't find an empty slot */
-    err_msg(errno, "add_client error: Too many clients");
+  }
+  if (i == FD_SETSIZE) {
+    /* Couldn't find an empty slot */
+    LoggerFactory::getLogger()->error(errno, "add_client error: Too many clients");
+
+  }
 }
 /* $end add_client */
 
@@ -101,17 +105,9 @@
   net_mod_response_head_t response_head;
   char request_head_bs[NET_MODE_REQUEST_HEAD_LENGTH];
   void  *recv_buf;
-  
+char tmp[8196];
   int recv_size;
 
-  // if(buf == NULL) {
-  //   buf = malloc(max_buf);
-  //   if(buf == NULL) {
-  //     err_exit(errno, "process_client malloc");
-  //   }
-  // }
-  
- 
   if (rio_readn(connfd, request_head_bs, NET_MODE_REQUEST_HEAD_LENGTH) !=  NET_MODE_REQUEST_HEAD_LENGTH)
   {
     return -1;
@@ -133,6 +129,7 @@
   }
 
   if(request_head.mod == REQ_REP) {
+    // TODO: shmModSocket.sendandrecv_unsafe
     shmModSocket.sendandrecv(buf, request_head.content_length, request_head.key, &recv_buf, &recv_size);
     response_head.content_length = recv_size;
     Rio_writen(connfd, NetModSocket::encode_response_head(response_head), NET_MODE_RESPONSE_HEAD_LENGTH);
@@ -168,7 +165,6 @@
   for (i = 0; (i <= pool.maxi) && (pool.nready > 0); i++)
   {
     connfd = pool.clientfd[i];
-    //rio = &pool.clientrio[i];
 
     /* If the descriptor is ready, echo a text line from it */
     if ((connfd > 0) && (FD_ISSET(connfd, &pool.ready_set)))

--
Gitblit v1.8.0