fix some bug

This commit is contained in:
ubuntu201711081 2020-12-06 12:26:38 +00:00
parent 22fd0dfea3
commit d02eb2e69c
4 changed files with 9 additions and 5 deletions

View File

@ -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:

View File

@ -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++;
}

View File

@ -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)){

View File

@ -9,6 +9,11 @@ function do_test(){
fi
}
if [[ ! -d 'tmp' ]]
then
mkdir tmp
fi
cd testdata
../server &
server_pid=$!