From bd4150a7693200c5782c791dbcf3700a9ff7730a Mon Sep 17 00:00:00 2001 From: afederici <ajf5@illinois.edu> Date: Sat, 21 Nov 2020 21:04:11 -0600 Subject: [PATCH] bug fix --- inc/Node.h | 2 +- mappers/wc.cpp | 2 +- src/TcpSocket.cpp | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/inc/Node.h b/inc/Node.h index ddf0dd0..7d8d123 100644 --- a/inc/Node.h +++ b/inc/Node.h @@ -40,7 +40,7 @@ using namespace std; #define N_b 5 // how many nodes GOSSIP want to use #define T_election 15 // in T_period #define T_switch 3 // in seconds -#define T_maples 80 // lines to process +#define T_maples 2 // lines to process // void *runUdpServer(void *udpSocket); diff --git a/mappers/wc.cpp b/mappers/wc.cpp index aeaa0e4..6a8535e 100644 --- a/mappers/wc.cpp +++ b/mappers/wc.cpp @@ -13,6 +13,6 @@ int main(int argc, char **argv) { } std::transform(str.begin(), str.end(), str.begin(), ::tolower); std::vector<std::string> temp = splitString(str, delim); - for (auto &e : temp) { if (e.size()) std::cout << e << "," << "1" << std::endl; } + for (auto &e : temp) { if (e.size() && e.compare(" ") && e.compare("\n")) std::cout << e << "," << "1" << std::endl; } } } diff --git a/src/TcpSocket.cpp b/src/TcpSocket.cpp index 8142c3e..6cef2e4 100644 --- a/src/TcpSocket.cpp +++ b/src/TcpSocket.cpp @@ -144,7 +144,7 @@ void TcpSocket::sendLines(string ip, string port, string execfile, string readfi lineCounter++; if (lineCounter < start) continue; if (lineCounter >= end) break; - numbytes += str.size(); + numbytes += (str.size() + 1); } file.clear(); // clear fail and eof bits file.seekg(0); // back to the start! @@ -163,6 +163,7 @@ void TcpSocket::sendLines(string ip, string port, string execfile, string readfi if (lineCounter < start) continue; else if (lineCounter == start) cout << "[CHUNK] starting to send at line " << to_string(lineCounter) << endl; if (lineCounter >= end) { cout << "[CHUNK] Counter at " << to_string(lineCounter) << " end: " << to_string(end) << endl; break; } + str += '\n'; if (send(sockfd, str.c_str(), strlen(str.c_str()), 0) == -1) { perror("send"); } -- GitLab