From 165b843da734e4a734fb37e6ab41cb7fc750c5a8 Mon Sep 17 00:00:00 2001 From: afederici <ajf5@illinois.edu> Date: Wed, 18 Nov 2020 22:02:10 -0600 Subject: [PATCH] bug fix --- src/Node.cpp | 2 ++ src/Utils.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/Node.cpp b/src/Node.cpp index f3d9711..0b770bf 100644 --- a/src/Node.cpp +++ b/src/Node.cpp @@ -910,9 +910,11 @@ void Node::handleTcpMessage() DIR *dp = nullptr; if ((dp = opendir(".")) == nullptr) { cout << "tmp directory error " << match << endl; break; } while ((entry = readdir(dp))){ + cout << "[FILES] found " << entry->d_name << " looking to match " << to_string(matchLen) << " chars from " << match << endl; if (strncmp(entry->d_name, match.c_str(), matchLen) == 0){ string searcher(entry->d_name); string target = searcher.substr(4); + cout << "[CHUNKACK] found " << entry->d_name << endl; Messages outMsg(DNS, nodeInformation.ip + "::" + to_string(hashRingPosition) + "::" + target + "::" + entry->d_name + "::" + to_string(-1) + "::" + to_string(-1) + "::" + target + "::" + "0"); cout << "[PUT] Got localfilename: " << entry->d_name << " with sdfsfilename: " << target << endl; tcpServent->sendMessage(leaderIP, TCPPORT, outMsg.toString()); diff --git a/src/Utils.cpp b/src/Utils.cpp index c970312..7733690 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -55,7 +55,9 @@ void handlePipe(int file, string prefix) { FILE *stream = fdopen(file, "r"); FILE *tmp; char str[bufSize]; const char * delim = ","; + int lines = 0; while ((fgets(str, bufSize, stream)) != NULL){ + lines++; std::string key(strtok(str, delim)); std::string val(strtok(NULL, delim)); string keyFile = "tmp-" + prefix + "-" + key; @@ -63,6 +65,7 @@ void handlePipe(int file, string prefix) { tmp = fopen(keyFile.c_str(), "ab"); fwrite(write.c_str(),sizeof(char),write.size(),tmp); fclose(tmp); + cout << "[PIPE] " << key << " to " << keyFile << endl; } fclose (stream); } -- GitLab