small changes

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

No files matched your search

BIN
View File
Binary file not shown.
+5 -7
View File
@@ -574,8 +574,6 @@ void service_block_request(void* arg) {
csc_block_t* block = (&casc_file->blocks[block_number]); csc_block_t* block = (&casc_file->blocks[block_number]);
pthread_mutex_lock(&casc_file->mutex);
if (!block->completed) { if (!block->completed) {
char response[9]; char response[9];
response[0] = 2; response[0] = 2;
@@ -588,6 +586,8 @@ void service_block_request(void* arg) {
return; return;
} }
pthread_mutex_lock(&casc_file->mutex);
FILE* fp = fopen(casc_file->outputfile, "rb+"); FILE* fp = fopen(casc_file->outputfile, "rb+");
fseek(fp, block->offset, SEEK_SET); fseek(fp, block->offset, SEEK_SET);
char buffer[block->length]; char buffer[block->length];
@@ -627,7 +627,6 @@ void server_mt() {
request->socket = new_socket; request->socket = new_socket;
pthread_create(&request_handler, NULL, service_block_request, (void*)request); 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_files[cascade_amount] = casc_file;
cascade_amount++; cascade_amount++;
// start client and server on separate threads
pthread_t client;
// subscribe to peer or get peers // subscribe to peer or get peers
if (download_only) { if (download_only) {
casc_file->peercount = send_tracker_request(&(casc_file->peers), casc_file->cascadehash, 1); 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); 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){ if (!casc_file->completed){
pthread_create(&client, NULL, client_mt, (void*)casc_file); pthread_create(&client, NULL, client_mt, (void*)casc_file);
clients[client_amount] = &client; 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
Whitespace-only changes.
File diff suppressed because it is too large. Load diff