Skip to content

Commit 4002db0

Browse files
authored
Merge pull request #423 from avinxshKD/fix/concoredocker-path-and-retry
fix: path slash and retry loop in concoredocker.hpp)
2 parents ed13e9e + b315c13 commit 4002db0

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
@@ -138,7 +138,7 @@ class Concore {
138138

139139
std::vector<std::string> read(int port, const std::string& name, const std::string& initstr) {
140140
std::this_thread::sleep_for(std::chrono::seconds(delay));
141-
std::string file_path = inpath + std::to_string(port) + "/" + name;
141+
std::string file_path = inpath + "/" + std::to_string(port) + "/" + name;
142142
std::ifstream infile(file_path);
143143
std::string ins;
144144

@@ -151,6 +151,7 @@ class Concore {
151151
int attempts = 0, max_retries = 5;
152152
while (ins.empty() && attempts < max_retries) {
153153
std::this_thread::sleep_for(std::chrono::seconds(delay));
154+
infile.close();
154155
infile.open(file_path);
155156
if (infile) std::getline(infile, ins);
156157
attempts++;
@@ -175,7 +176,7 @@ class Concore {
175176
}
176177

177178
void write(int port, const std::string& name, const std::vector<std::string>& val, int delta = 0) {
178-
std::string file_path = outpath + std::to_string(port) + "/" + name;
179+
std::string file_path = outpath + "/" + std::to_string(port) + "/" + name;
179180
std::ofstream outfile(file_path);
180181
if (!outfile) {
181182
std::cerr << "Error writing to " << file_path << "\n";

0 commit comments

Comments
 (0)