diff --git a/lookup.c b/lookup.c index afc8430..feb985d 100644 --- a/lookup.c +++ b/lookup.c @@ -1,5 +1,8 @@ #include "lookup.h" +static int free_space = TABLE_SIZE; +static lookup_head *table; + void init_lookup_table() { table = malloc(sizeof(lookup_head)); diff --git a/lookup.h b/lookup.h index 6454592..fb5b29e 100644 --- a/lookup.h +++ b/lookup.h @@ -15,9 +15,6 @@ typedef struct lookup_head lookup_table *head; }lookup_head; -static lookup_head *table; -static int free_space = TABLE_SIZE; - void init_lookup_table(); void push_lookup(lookup_request *request); diff --git a/webserver.c b/webserver.c index 4ef27c2..00f1076 100644 --- a/webserver.c +++ b/webserver.c @@ -120,14 +120,6 @@ void send_reply(int conn, struct request *request) { fprintf(stderr, "Resource hash: %u\n", resource_hash); - if (resource_hash == -1) - { - perror("Pseudo_hash failed - 404\n"); - reply = "HTTP/1.1 404 Not Found\r\nContent-Length: 0\r\n\r\n"; - offset = strlen(reply); - goto direct_send; - } - neighbor responsible = check_neighborhood(resource_hash); lookup_request *req = find_lookup(resource_hash); @@ -207,9 +199,6 @@ void send_reply(int conn, struct request *request) { offset = strlen(reply); } - direct_send: // ... do goto, yes you read that right ;) - - //offset = strlen(reply); // Send the reply back to the client if (send(conn, reply, offset, 0) == -1) { perror("send"); @@ -438,7 +427,7 @@ static int setup_server_socket_udp(struct sockaddr_in addr){ static void handle_udp_request(){ fprintf(stderr, "---%d---\n", _NODE_ID); - size_t received_bytes = 0; + ssize_t received_bytes = 0; lookup_request lr = {0}; struct sockaddr_storage caller_addr;