add DEFAULT_RESPONSE_REQUEST

This commit is contained in:
ubuntu201711081 2020-12-05 17:39:15 +00:00
parent b7cbf73ce3
commit 38a094ff41
2 changed files with 14 additions and 5 deletions

View File

@ -25,9 +25,9 @@ For server
- DEFAULT_MAX_PATH_SIZE: 256(must be less than 1000) - DEFAULT_MAX_PATH_SIZE: 256(must be less than 1000)
- USE_SENDFILE - USE_SENDFILE
- DEFAULT_SEND_FILE_CHUNK_SIZE: 0x100000(1MB) - DEFAULT_SEND_FILE_CHUNK_SIZE: 0x100000(1MB)
- DEFAULT_WORK_QUEUE_SIZE: 10 - DEFAULT_WORK_QUEUE_SIZE(server only): 10
- DEFAULT_MAX_THREAD_NUMBER: 10 - DEFAULT_MAX_THREAD_NUMBER(server only): 10
- DEFAULT_RESPONSE_REQUEST(p-server only): 3(-1 is INF)
For client For client
- MUL_CLIENT(second unit) - MUL_CLIENT(second unit)
- SLOW_CLIENT(microsecond unit, (buf_size/SLOW_CLIENT) bytes/usec) - SLOW_CLIENT(microsecond unit, (buf_size/SLOW_CLIENT) bytes/usec)

View File

@ -15,7 +15,11 @@
#include <sys/wait.h> #include <sys/wait.h>
#include "socket_wrapper.h" #include "socket_wrapper.h"
#ifndef DEFAULT_MAX_LISTEN_SOCKET
static const int MAX_LISTEN_SOCKET = 16; static const int MAX_LISTEN_SOCKET = 16;
#else
static const int MAX_LISTEN_SOCKET = DEFAULT_MAX_LISTEN_SOCKET;
#endif
#ifdef USE_SENDFILE #ifdef USE_SENDFILE
#include <sys/sendfile.h> #include <sys/sendfile.h>
@ -41,6 +45,11 @@ static const int TIMEOUT = 5;
#else #else
static const int TIMEOUT = DEFAULT_TIMEOUT; static const int TIMEOUT = DEFAULT_TIMEOUT;
#endif #endif
#ifndef DEFAULT_RESPONSE_REQUEST
static const int RESPONSE_REQUEST = 3;
#else
static const int RESPONSE_REQUEST = DEFAULT_RESPONSE_REQUEST;
#endif
/*======== /*========
*Operation *Operation
@ -261,7 +270,7 @@ int main(int argc, const char *argv[]){
return 1; return 1;
} }
for (i = 0; i < 3; i++) for (i = 0; i < RESPONSE_REQUEST; i++)
{ {
int fd, pid; int fd, pid;
char ip_buf[INET_ADDRSTRLEN]; char ip_buf[INET_ADDRSTRLEN];
@ -287,7 +296,7 @@ int main(int argc, const char *argv[]){
return retval; return retval;
} }
} }
for (i = 0; i < 3; i++) for (i = 0; i < RESPONSE_REQUEST; i++)
{ {
int retval; int retval;
int pid = wait(&retval); int pid = wait(&retval);