Skip to content

Commit b315c13

Browse files
committed
fix: path slash and retry loop in concoredocker.hpp)
1 parent f21bb89 commit b315c13

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

concoredocker.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class Concore {
8181

8282
std::vector<std::string> read(int port, const std::string& name, const std::string& initstr) {
8383
std::this_thread::sleep_for(std::chrono::seconds(delay));
84-
std::string file_path = inpath + std::to_string(port) + "/" + name;
84+
std::string file_path = inpath + "/" + std::to_string(port) + "/" + name;
8585
std::ifstream infile(file_path);
8686
std::string ins;
8787

@@ -94,6 +94,7 @@ class Concore {
9494
int attempts = 0, max_retries = 5;
9595
while (ins.empty() && attempts < max_retries) {
9696
std::this_thread::sleep_for(std::chrono::seconds(delay));
97+
infile.close();
9798
infile.open(file_path);
9899
if (infile) std::getline(infile, ins);
99100
attempts++;
@@ -110,7 +111,7 @@ class Concore {
110111
}
111112

112113
void write(int port, const std::string& name, const std::vector<std::string>& val, int delta = 0) {
113-
std::string file_path = outpath + std::to_string(port) + "/" + name;
114+
std::string file_path = outpath + "/" + std::to_string(port) + "/" + name;
114115
std::ofstream outfile(file_path);
115116
if (!outfile) {
116117
std::cerr << "Error writing to " << file_path << "\n";

0 commit comments

Comments
 (0)