From d9d5c2d3089345fa858deaf2c0dfbfb304b7a9f6 Mon Sep 17 00:00:00 2001 From: wangzhengquan <wangzhengquan85@126.com> Date: 星期五, 16 十月 2020 20:08:52 +0800 Subject: [PATCH] udpate --- src/socket/net_mod_server_socket.c | 21 ++++++++------------- 1 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/socket/net_mod_server_socket.c b/src/socket/net_mod_server_socket.c index f475b3a..b95c20b 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; @@ -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))) -- Gitblit v1.8.0