diff --git a/src/Node.cpp b/src/Node.cpp index f3d9711d62d832d678f12fc12fbbed1e0caef65c..0b770bf289a2a8485ecad10c66dd9a55b4600f65 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 c97031258eebd4691a35d33082f42f00c5413875..773369091e93ea6d0e5b5f6952a657cc2eb169e8 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); }