diff --git a/src/Node.cpp b/src/Node.cpp index c35cd87e7e494eb517174358c816c54db29867e2..e06d49741515a7a9ef386f55a0784e38ebd63ee6 100644 --- a/src/Node.cpp +++ b/src/Node.cpp @@ -826,7 +826,7 @@ void Node::handleTcpMessage() if (inMsg.size() >= 4){ string mapleExe = inMsg[0], num_maples = inMsg[1], sdfsPre = inMsg[2], sdfs_dir = inMsg[3] + "-"; int workers = stoi(num_maples); - if (workers > hashRing->nodePositions.size()-1) workers = hashRing->nodePositions.size()-1; + if (workers > hashRing->nodePositions.size()-2) workers = hashRing->nodePositions.size()-2; int total_lines = 0; vector<tuple<string,int>> directory; cout << "[DIRECTORY] " << sdfs_dir << endl; @@ -841,7 +841,7 @@ void Node::handleTcpMessage() } cout << "[MAPLE] need to process " << to_string(total_lines) << endl; vector<tuple<string,string,string>> aliveNodes; - for (auto &e : membershipList) aliveNodes.push_back(e.first); + for (auto &e : membershipList) if (e.first.compare(nodeInformation.ip)) aliveNodes.push_back(e.first); vector<tuple<string,string,string>> mapleNodes = randItems(workers, aliveNodes); string includedDebug = ""; for (auto &e : mapleNodes) { diff --git a/src/TcpSocket.cpp b/src/TcpSocket.cpp index c2a9b96dc0f7221f6c07929ea7fb09d7a2a84855..863cb4aed2bfdbddb5d81d8dbf4fbc0fef8b39e3 100644 --- a/src/TcpSocket.cpp +++ b/src/TcpSocket.cpp @@ -152,7 +152,7 @@ void TcpSocket::sendLines(string ip, string port, string execfile, string readfi lineCounter++; if (lineCounter < start) continue; else if (lineCounter == start) cout << "[CHUNK] starting to send at line " << to_string(lineCounter) << endl; - if (lineCounter >= end) { cout << "Counter at " << to_string(lineCounter) << " end: " << to_string(end) << endl; break; } + if (lineCounter >= end) { cout << "[CHUNK] Counter at " << to_string(lineCounter) << " end: " << to_string(end) << endl; break; } if (send(sockfd, str.c_str(), strlen(str.c_str()), 0) == -1) { perror("send"); } @@ -293,7 +293,7 @@ int TcpSocket::messageHandler(int sockfd, string payloadMessage, string returnIP case CHUNK: case CHUNKACK: case DNS:{ - cout << "Type: " << messageTypes[msg.type] << " payloadMessage: " << payloadMessage << endl; + cout << "["<< messageTypes[msg.type] << "] payloadMessage: " << payloadMessage << endl; regMessages.push(payloadMessage); //handle from queue break; }