Commit 50842841 authored by Saikumar's avatar Saikumar

Updated server.cpp

parent fbfb08c5
...@@ -52,8 +52,8 @@ void *respondToClient(void *args) { ...@@ -52,8 +52,8 @@ void *respondToClient(void *args) {
string key_string, value_string; string key_string, value_string;
switch(todo) { switch(todo) {
case '1': case '1':
// printf("GET recvd\n"); // printf("GET :\n");
// printf("Key: %s\n", key); printf("Key: %s\n", key);
// j = search(key); // j = search(key);
// printf("j=%d\n", j); // printf("j=%d\n", j);
key_string = key; key_string = key;
...@@ -67,9 +67,9 @@ void *respondToClient(void *args) { ...@@ -67,9 +67,9 @@ void *respondToClient(void *args) {
write(clientFd, converted_output, output.length()); write(clientFd, converted_output, output.length());
break; break;
case '2': case '2':
// printf("PUT recvd\n"); printf("PUT :\n");
// printf("Key: %s\n", key); printf("Key: %s\n", key);
// printf("Value: %s\n", value); printf("Value: %s\n", value);
key_string = key; key_string = key;
value_string = value; value_string = value;
// pthread_mutex_lock(&cLock); // pthread_mutex_lock(&cLock);
...@@ -80,8 +80,8 @@ void *respondToClient(void *args) { ...@@ -80,8 +80,8 @@ void *respondToClient(void *args) {
write(clientFd, converted_output, output.length()); write(clientFd, converted_output, output.length());
break; break;
case '3': case '3':
// printf("DELETE recvd\n"); printf("DELETE :\n");
// printf("Key: %s\n", key); printf("Key: %s\n", key);
key_string = key; key_string = key;
// pthread_mutex_lock(&cLock); // pthread_mutex_lock(&cLock);
output = DEL(key_string); output = DEL(key_string);
...@@ -168,6 +168,7 @@ int main(int argc, char **argv) { ...@@ -168,6 +168,7 @@ int main(int argc, char **argv) {
char ip[20], portNo[10]; char ip[20], portNo[10];
int nThreads; int nThreads;
pthread_mutex_init(&lock, NULL); pthread_mutex_init(&lock, NULL);
initializeCache();
initVals(ip, portNo, &nThreads); initVals(ip, portNo, &nThreads);
printf("Ip address: %s\n", ip); printf("Ip address: %s\n", ip);
printf("portno: %s\n", portNo); printf("portno: %s\n", portNo);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment