From 3c97cad04cf4280ebdd16f281d93950190915078 Mon Sep 17 00:00:00 2001
From: afederici <ajf5@illinois.edu>
Date: Sat, 21 Nov 2020 15:05:50 -0600
Subject: [PATCH] logging

---
 src/Node.cpp      | 4 ++--
 src/TcpSocket.cpp | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/Node.cpp b/src/Node.cpp
index c35cd87..e06d497 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 c2a9b96..863cb4a 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;
 		}
-- 
GitLab