From d02eb2e69c513bb145e21bce4969a9c4645ffc67 Mon Sep 17 00:00:00 2001 From: ubuntu201711081 <201711081@jbnu.ac.kr> Date: Sun, 6 Dec 2020 12:26:38 +0000 Subject: [PATCH] fix some bug --- README.md | 1 + client.c | 2 -- server.c | 6 +++--- test.sh | 5 +++++ 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 30bd1d3..ff93f02 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Server OPTION and arguments: Client option and arguments: - `-b` or `--benchmark` :benchmark mode - `-nv` or `--no-verbose` :no progress bar +- `-t [number]` or `--thread [number]` :set to thread number. Available macro: diff --git a/client.c b/client.c index b292071..6958711 100644 --- a/client.c +++ b/client.c @@ -286,7 +286,6 @@ void * WorkerProc(void * args){ filename = filename_buf; } pthread_mutex_unlock(&global_state.queueing_mutex); - fprintf(stdout,"request %s\n",filename); ret->retval += SendOpAndReceiveFile(filename,&arg->addr); ret->op_count++; @@ -375,7 +374,6 @@ int main(int argc, const char *argv[]){ if (t != 1) break; filename = filename_buf; } - fprintf(stdout,"request %s\n",filename); retval += SendOpAndReceiveFile(filename,(struct sockaddr *)&addr); bench.op_count++; } diff --git a/server.c b/server.c index 1f0c277..81ec9eb 100644 --- a/server.c +++ b/server.c @@ -253,7 +253,7 @@ typedef struct WorkerArgument uint8_t * buf; //pthread_mutex_t * cond_mutex; - //pthread_cond_t cond; + //pthread_cond_t cond; } worker_argument_t; @@ -345,7 +345,7 @@ int main(int argc, const char *argv[]){ char ip_buf[INET_ADDRSTRLEN]; const char * msg = inet_ntop(AF_INET,&addr.sin_addr,ip_buf,sizeof(ip_buf)); assert(msg != NULL); - fprintf(stderr,"server bind on %s:%d\n",msg ,binding_port_number); + fprintf(stdout,"server bind on %s:%d\n",msg ,binding_port_number); } if(listen(sock,MAX_LISTEN_SOCKET) < 0){ @@ -357,7 +357,7 @@ int main(int argc, const char *argv[]){ { char ip_buf[INET_ADDRSTRLEN]; const char * msg = inet_ntop(AF_INET,&client_addr.sin_addr,ip_buf,sizeof(ip_buf)); - fprintf(stderr,"Connected on : %s:%d\n",msg == NULL ? "(null)" : msg , ntohs(addr.sin_port)); + fprintf(stdout,"Connected on : %s:%d\n",msg == NULL ? "(null)" : msg , ntohs(addr.sin_port)); for(;;){ pthread_mutex_lock(&globalState.sock_mutex); if (queue_isfull(&globalState.socks)){ diff --git a/test.sh b/test.sh index 0a7ef45..b98482d 100755 --- a/test.sh +++ b/test.sh @@ -9,6 +9,11 @@ function do_test(){ fi } +if [[ ! -d 'tmp' ]] +then + mkdir tmp +fi + cd testdata ../server & server_pid=$!