small changes
This commit is contained in:
BIN
A4/src/cascade
BIN
A4/src/cascade
Binary file not shown.
@ -574,8 +574,6 @@ void service_block_request(void* arg) {
|
||||
|
||||
csc_block_t* block = (&casc_file->blocks[block_number]);
|
||||
|
||||
pthread_mutex_lock(&casc_file->mutex);
|
||||
|
||||
if (!block->completed) {
|
||||
char response[9];
|
||||
response[0] = 2;
|
||||
@ -588,6 +586,8 @@ void service_block_request(void* arg) {
|
||||
return;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&casc_file->mutex);
|
||||
|
||||
FILE* fp = fopen(casc_file->outputfile, "rb+");
|
||||
fseek(fp, block->offset, SEEK_SET);
|
||||
char buffer[block->length];
|
||||
@ -627,7 +627,6 @@ void server_mt() {
|
||||
request->socket = new_socket;
|
||||
|
||||
pthread_create(&request_handler, NULL, service_block_request, (void*)request);
|
||||
//pthread_join(&request_handler, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -709,10 +708,6 @@ void start_peer(char* cascade_file){
|
||||
cascade_files[cascade_amount] = casc_file;
|
||||
cascade_amount++;
|
||||
|
||||
// start client and server on separate threads
|
||||
pthread_t client;
|
||||
|
||||
|
||||
// subscribe to peer or get peers
|
||||
if (download_only) {
|
||||
casc_file->peercount = send_tracker_request(&(casc_file->peers), casc_file->cascadehash, 1);
|
||||
@ -720,6 +715,9 @@ void start_peer(char* cascade_file){
|
||||
casc_file->peercount = send_tracker_request(&(casc_file->peers), casc_file->cascadehash, 2);
|
||||
}
|
||||
|
||||
// start client and server on separate threads
|
||||
pthread_t client;
|
||||
|
||||
if (!casc_file->completed){
|
||||
pthread_create(&client, NULL, client_mt, (void*)casc_file);
|
||||
clients[client_amount] = &client;
|
||||
|
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user