Commit 9cee4e2d authored by mayankkakad's avatar mayankkakad

errors rectified

parent 731414cf
......@@ -330,6 +330,11 @@ public:
cout << endl;
}
int hash(string s)
{
return (((int)s.at(0)) << 8) + ((int)s.at(1));
}
string getKeyValuePairs(int id)
{
unordered_map<string, string> flush;
......@@ -379,15 +384,9 @@ public:
closedir(dirFile);
}
Node *temp = head->next;
while (temp->next)
{
if (hash(temp->key) <= id)
{
flush[temp->key] = temp->payload;
}
temp = temp->next;
}
for(int i=0;i<=curr_pos;i++)
if(hash(cacheHeap[i]->key)<=id)
flush[cacheHeap[i]->key]=cacheHeap[i]->value;
unordered_map<string, string>::iterator itr;
for (itr = flush.begin(); itr != flush.end(); itr++)
......
......@@ -186,7 +186,13 @@ private:
RequestType reqType;
};
void signalHandler(int signum) {
remove(SERVERS);
exit(0);
}
int main(int argc,char **argv) {
signal(SIGINT, signalHandler);
srand(time(0));
string server_address("0.0.0.0:1234");
builder.AddListeningPort(server_address, grpc::InsecureServerCredentials());
......
This diff is collapsed.
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