diff --git a/hw b/hw index 454e7f2..784ef2a 100755 Binary files a/hw and b/hw differ diff --git a/hw.c b/hw.c index 83c2b2b..38015a0 100644 --- a/hw.c +++ b/hw.c @@ -507,8 +507,9 @@ void save_response_to_cache(struct req_http_message req_message, struct res_http break; } } - - printf("[Info] Caching object with Max-Age = %d, ETag = \"%s\"\n", new_entry->maxAge, new_entry->ETag); + if (DEBUG_MODE == DEBUG_ASSIGNMENT) { + printf("[Info] Caching object with Max-Age = %d, ETag = \"%s\"\n", new_entry->maxAge, new_entry->ETag); + } // Add to cache @@ -529,7 +530,7 @@ void save_response_to_cache(struct req_http_message req_message, struct res_http if (!placed) { cache[cacheCount] = new_entry; } - + cacheCount++; } @@ -563,7 +564,6 @@ void print_res_http_message(struct res_http_message message) { // Main int main(int argc, char *argv[]) { - // Setup TCP Socket if (DEBUG_MODE >= DEBUG_EXTENDED) printf("SETUP: Setup Sockets\n"); int serv_sock, client_sock, read_size; @@ -645,7 +645,9 @@ int main(int argc, char *argv[]) { printf("[Info] Must revalidate with server using If-None-Match: \"%s\"\n", cache[cache_hit]->ETag); } else { // Cache Miss (Case 1) - printf("[Info] Object not in cache. Contacting server\n"); + if (DEBUG_MODE == DEBUG_ASSIGNMENT) { + printf("[Info] Object not in cache. Contacting server\n"); + } } // Process Message for Relay @@ -740,7 +742,13 @@ int main(int argc, char *argv[]) { // Close Client Socket close(client_sock); - if (DEBUG_MODE >= DEBUG_INFO) {printf("DISCONNECT: Client Disconnected\n\n");} + if (DEBUG_MODE >= DEBUG_INFO) { + printf("DISCONNECT: Client Disconnected\n\n"); + } + + if (DEBUG_MODE == DEBUG_ASSIGNMENT) { + printf("===============================================================================================\n"); + } } return 0;