diff --git a/inc/Node.h b/inc/Node.h index ddf0dd00fb0f9cf948b32479cd9fba3ec9df9569..7d8d123a22be7907fe5beb54c1d579f32e9293d3 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 aeaa0e44630c39a49be41798d3d42ae1520b313a..6a8535ee81159f92601e7742e8d4a544b8470d0e 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 8142c3ec41a9971bc73749413d636014c817b268..6cef2e4a3a1d4395064d29430dd6aa3cdac95995 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"); }