Skip to content

Commit

Permalink
fix clients leak
Browse files Browse the repository at this point in the history
Signed-off-by: Ric Li <[email protected]>
  • Loading branch information
ricmli committed Nov 16, 2023
1 parent 8e9a0f0 commit 698ed12
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion manager/logging.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class logger {
}
}

static void setlog_level(log_level level) { log_level_min = level; }
static void set_log_level(log_level level) { log_level_min = level; }

private:
static log_level log_level_min;
Expand Down
10 changes: 6 additions & 4 deletions manager/mtl_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ int main() {
std::vector<mtl_instance*> clients;
std::shared_ptr<mtl_lcore> lcore_manager = std::make_shared<mtl_lcore>();

logger::setlog_level(log_level::INFO);
logger::set_log_level(log_level::INFO);

fs::path directory_path(MTL_MANAGER_SOCK_PATH);
directory_path.remove_filename();
Expand Down Expand Up @@ -180,12 +180,14 @@ int main() {
}
}

logger::log(log_level::INFO, "MTL Manager exited.");

out:
clients.clear();
for (auto it = clients.begin(); it != clients.end(); ++it) {
delete *it;
}
if (signal_fd >= 0) close(signal_fd);
if (epfd >= 0) close(epfd);
if (sockfd >= 0) close(sockfd);

logger::log(log_level::INFO, "MTL Manager exited.");
return ret;
}

0 comments on commit 698ed12

Please sign in to comment.