From 38a094ff4183d7b1f9b279a41420cf2c8ba76ee7 Mon Sep 17 00:00:00 2001 From: ubuntu201711081 <201711081@jbnu.ac.kr> Date: Sat, 5 Dec 2020 17:39:15 +0000 Subject: [PATCH] add DEFAULT_RESPONSE_REQUEST --- README.md | 6 +++--- p-server.c | 13 +++++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3abe2be..bb95630 100644 --- a/README.md +++ b/README.md @@ -25,9 +25,9 @@ For server - DEFAULT_MAX_PATH_SIZE: 256(must be less than 1000) - USE_SENDFILE - DEFAULT_SEND_FILE_CHUNK_SIZE: 0x100000(1MB) -- DEFAULT_WORK_QUEUE_SIZE: 10 -- DEFAULT_MAX_THREAD_NUMBER: 10 - +- DEFAULT_WORK_QUEUE_SIZE(server only): 10 +- DEFAULT_MAX_THREAD_NUMBER(server only): 10 +- DEFAULT_RESPONSE_REQUEST(p-server only): 3(-1 is INF) For client - MUL_CLIENT(second unit) - SLOW_CLIENT(microsecond unit, (buf_size/SLOW_CLIENT) bytes/usec) diff --git a/p-server.c b/p-server.c index a455a61..5d61b64 100644 --- a/p-server.c +++ b/p-server.c @@ -15,7 +15,11 @@ #include #include "socket_wrapper.h" +#ifndef DEFAULT_MAX_LISTEN_SOCKET static const int MAX_LISTEN_SOCKET = 16; +#else +static const int MAX_LISTEN_SOCKET = DEFAULT_MAX_LISTEN_SOCKET; +#endif #ifdef USE_SENDFILE #include @@ -41,6 +45,11 @@ static const int TIMEOUT = 5; #else static const int TIMEOUT = DEFAULT_TIMEOUT; #endif +#ifndef DEFAULT_RESPONSE_REQUEST +static const int RESPONSE_REQUEST = 3; +#else +static const int RESPONSE_REQUEST = DEFAULT_RESPONSE_REQUEST; +#endif /*======== *Operation @@ -261,7 +270,7 @@ int main(int argc, const char *argv[]){ return 1; } - for (i = 0; i < 3; i++) + for (i = 0; i < RESPONSE_REQUEST; i++) { int fd, pid; char ip_buf[INET_ADDRSTRLEN]; @@ -287,7 +296,7 @@ int main(int argc, const char *argv[]){ return retval; } } - for (i = 0; i < 3; i++) + for (i = 0; i < RESPONSE_REQUEST; i++) { int retval; int pid = wait(&retval);