add slow client
This commit is contained in:
parent
9d012b2c6c
commit
226a0fbdc6
2
Makefile
2
Makefile
@ -18,6 +18,8 @@ p-server: socket_wrapper.o p-server.c
|
||||
$(CC) -o p-server p-server.c socket_wrapper.o $(CFLAGS)
|
||||
p-client: socket_wrapper.o p-client.c
|
||||
$(CC) -o p-client p-client.c socket_wrapper.o $(CFLAGS)
|
||||
p-slowclient: socket_wrapper.o p-client.c
|
||||
$(CC) -o p-slowclient p-client.c socket_wrapper.o $(CFLAGS) -D SLOW_CLIENT=10
|
||||
|
||||
.PHONY: clean moveall
|
||||
clean:
|
||||
|
@ -19,4 +19,5 @@ Available macro:
|
||||
- DEFAULT_MAX_PATH_SIZE : 256(must be less than 1000)
|
||||
- TIMEOUT : 5(second unit)
|
||||
- USE_SENDFILE
|
||||
- DEFAULT_SEND_FILE_CHUNK_SIZE : 0x100000(1MB)
|
||||
- DEFAULT_SEND_FILE_CHUNK_SIZE : 0x100000(1MB)
|
||||
- SLOW_CLIENT(second unit)
|
@ -39,6 +39,9 @@ int sendReadOp(int sock,const char * filename){
|
||||
perror("readop send fail");
|
||||
return -1;
|
||||
}
|
||||
#ifdef SLOW_CLIENT
|
||||
sleep(SLOW_CLIENT);
|
||||
#endif
|
||||
if(send(sock,filename,op.file_url_size,0)<0){
|
||||
perror("readop filename send fail");
|
||||
return -1;
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <signal.h>
|
||||
#include <assert.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/wait.h>
|
||||
#include "socket_wrapper.h"
|
||||
|
||||
static const int MAX_LISTEN_SOCKET = 16;
|
||||
@ -284,6 +285,13 @@ int main(int argc, const char *argv[]){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
int retval;
|
||||
int pid = wait(&retval);
|
||||
printf("[%d] %d: %d\n",i,pid,retval);
|
||||
}
|
||||
|
||||
free(buf);
|
||||
return 0;
|
||||
}
|
3
pctest.sh
Executable file
3
pctest.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#! /bin/bash
|
||||
cd client_test
|
||||
./p-slowclient localhost 9091 test.txt & ./p-client localhost 9091 test.txt & ./p-client localhost 9091 test.txt
|
Loading…
Reference in New Issue
Block a user