diff options
author | Matt Strapp <strap012@umn.edu> | 2020-11-16 22:00:27 -0600 |
---|---|---|
committer | Matt Strapp <strap012@umn.edu> | 2020-11-16 22:00:27 -0600 |
commit | 674eaabdb462edde349902ac6e5cb51bbb8476c9 (patch) | |
tree | 51b42a4c0e34c88ec2da97b6285a26c87f9b6fe9 | |
parent | break everything (diff) | |
download | csci4061-674eaabdb462edde349902ac6e5cb51bbb8476c9.tar csci4061-674eaabdb462edde349902ac6e5cb51bbb8476c9.tar.gz csci4061-674eaabdb462edde349902ac6e5cb51bbb8476c9.tar.bz2 csci4061-674eaabdb462edde349902ac6e5cb51bbb8476c9.tar.lz csci4061-674eaabdb462edde349902ac6e5cb51bbb8476c9.tar.xz csci4061-674eaabdb462edde349902ac6e5cb51bbb8476c9.tar.zst csci4061-674eaabdb462edde349902ac6e5cb51bbb8476c9.zip |
help
-rw-r--r-- | P3/server.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/P3/server.c b/P3/server.c index e9cce2b..49ec1be 100644 --- a/P3/server.c +++ b/P3/server.c @@ -131,14 +131,15 @@ void * dispatch(void *arg) { //Add things to queue. Lock & unlock to prevent a deadlock pthread_mutex_lock(&Qlock); request_t * tempNode = (request_t*) calloc(1, sizeof(request_t *)); // Yes, he spelled it like that on purpose - char* tempBuf = (char *) malloc(BUFF_SIZE); // Buffer to store the requested filename + char* dispatchBuf = (char *) malloc(BUFF_SIZE); // Buffer to store the requested filename pthread_mutex_unlock(&Qlock); - if (get_request(newReq, tempBuf) != 0) + if (get_request(newReq, dispatchBuf) != 0) continue; // If get_request fails, try again + //Hopefully this works. Please work. Please. tempNode->fd = newReq; - tempNode->request = tempBuf; + tempNode->request = dispatchBuf; break; } else { traverse = traverse -> next; @@ -177,8 +178,11 @@ void * worker(void *arg) { fclose(log); pthread_mutex_unlock(&logLock); // return the result - char *tempBuf = (char *)calloc(BUFF_SIZE, sizeof(char)); - return_result(request->fd, getContentType(request->request), tempBuf, ); + char *workerBuf = (char *)calloc(BUFF_SIZE, sizeof(char)); + //TODO! Fix this holy shit + // call readFromDisk and read that shit into workerBuf and then call + readFromDisk(... dispatchBuf); + return_result(request->fd, getContentType(request->request), workerBuf, ); } return NULL; } |