diff options
author | Matt Strapp <strap012@umn.edu> | 2020-11-18 18:19:43 -0600 |
---|---|---|
committer | Matt Strapp <strap012@umn.edu> | 2020-11-18 18:19:43 -0600 |
commit | 606faf1ac7bd9dc0aa7d9355b715f976eefaf329 (patch) | |
tree | cb70dff5009b5c50d2c67cba1208f4f6e87bc76e | |
parent | aaaaaaaaaaaaaaaaaaaaaaaaa (diff) | |
download | csci4061-606faf1ac7bd9dc0aa7d9355b715f976eefaf329.tar csci4061-606faf1ac7bd9dc0aa7d9355b715f976eefaf329.tar.gz csci4061-606faf1ac7bd9dc0aa7d9355b715f976eefaf329.tar.bz2 csci4061-606faf1ac7bd9dc0aa7d9355b715f976eefaf329.tar.lz csci4061-606faf1ac7bd9dc0aa7d9355b715f976eefaf329.tar.xz csci4061-606faf1ac7bd9dc0aa7d9355b715f976eefaf329.tar.zst csci4061-606faf1ac7bd9dc0aa7d9355b715f976eefaf329.zip |
h
-rw-r--r-- | P3/server.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/P3/server.c b/P3/server.c index a8667d2..4becd1b 100644 --- a/P3/server.c +++ b/P3/server.c @@ -118,8 +118,7 @@ void addIntoCache(char *mybuf, char *memory, int memory_size) traverse = traverse->next; } pthread_mutex_lock(&cacheLock); - if (fullCache) - { + if (fullCache) { cache_entry_t *temp = dynQ; dynQ = dynQ->next; free(temp->content); @@ -128,19 +127,14 @@ void addIntoCache(char *mybuf, char *memory, int memory_size) cacheLength--; pthread_mutex_unlock(&cacheLock); addIntoCache(mybuf, memory, memory_size); - } - else - { + } else { cache_entry_t *temp = calloc(1, sizeof(cache_entry_t)); temp->request = mybuf; temp->content = memory; temp->len = memory_size; - if (cacheLength == 0) - { + if (cacheLength == 0) { dynQ = temp; - } - else - { + } else { traverse->next = temp; } cacheLength++; @@ -371,7 +365,7 @@ void *worker(void *arg) else { //Not in cache, disk read succeeds - addIntoCache(request->request, workerBuf, (int)numbytes); + addIntoCache(request->request, workerBuf, (unsigned int)numbytes); } } } |