small changes

This commit is contained in:
Nikolaj
2021-12-05 14:36:27 +01:00
parent da1b940597
commit 066ca1ca8a
8 changed files with 5 additions and 334499 deletions

Binary file not shown.

View File

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