wangzhengquan
2020-10-16 d9d5c2d3089345fa858deaf2c0dfbfb304b7a9f6
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;
@@ -168,7 +164,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)))