Commit 2cf6ddb2 authored by mayankkakad's avatar mayankkakad

errors rectified

parent 9cee4e2d
......@@ -160,6 +160,7 @@ void RunClient() {
Info info;
ClientContext context;
Status status=stub->GETADDRESS(&context,null,&info);
std::cout<<"Server: "<<info.address()<<std::endl;
std::string target_address(info.address());
// Instantiates the client
KeyValueServicesClient client(
......
......@@ -337,7 +337,7 @@ public:
//return half of the keyvalue pairs to the requesting node
string address=info.address();
int id=stoi(address.substr(address.find(':')+1));
string keyvalues=memManager->getKeyValuePairs(id);
string keyvalues=memManager->getKeyValuePairs(id,stoi(params["LISTENING_PORT"]));
string keys=keyvalues.substr(0,keyvalues.find(";;")+1);
string values=keyvalues.substr(keyvalues.find(";;")+2);
cout<<"Okay, my new predecessor is: "<<info.address()<<endl;
......@@ -1041,15 +1041,19 @@ public:
int my_id=stoi(params.find("LISTENING_PORT")->second);
ifstream fin;
fin.open(NEIGHBOURS);
string pred;
getline(fin,pred);
string pred,scc;
getline(fin,scc);
getline(fin,pred);
fin.close();
int pred_id;
int pred_id,succ_id;
if(pred=="-1")
pred_id=-1;
else
pred_id=stoi(pred.substr(pred.find(':')+1));
if(scc=="-1")
succ_id=-1;
else
succ_id=stoi(scc.substr(scc.find(':')+1));
if(my_id<key_id&&!(pred_id<key_id&&pred_id>my_id)) {
//transfer request
int fingers[16];
......@@ -1226,7 +1230,7 @@ public:
stat.set_status(200);
}
else {
if(pred_id==-1||pred_id<key_id) {
if(pred_id==-1||(pred_id<key_id&&my_id>=key_id)||(pred_id>my_id&&my_id>=key_id)) {
cout << "SERVER SERVES A PUT REQUEST WITH PARAMETER KEY : " << keyvalue.key() << " & VALUE : " << keyvalue.value() << endl;
......
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