From 1b662c07a7067b778cf351fe14bd6852b0333bfe Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sat, 16 Oct 2021 01:58:15 +0200 Subject: [PATCH] Clean up group host socket endpoint files Apparently we just left these behind. Now all yabridge related files should be gone from the temporary directories if yabridge exits cleanly. --- CHANGELOG.md | 6 ++++++ src/wine-host/bridges/group.cpp | 15 +++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8e18253..d86ab81b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,12 @@ Versioning](https://semver.org/spec/v2.0.0.html). running the Wine process under a separate namespace. If you don't know that you need this, then you probably don't need this! +### Fixed + +- The socket endpoint used by a plugin group host process to accept new + connections now gets removed when the group host process shuts down. + Previously this would leave behind a file in the temporary directory. + ## [3.6.0] - 2021-10-15 ### Added diff --git a/src/wine-host/bridges/group.cpp b/src/wine-host/bridges/group.cpp index 830650f0..b9d76604 100644 --- a/src/wine-host/bridges/group.cpp +++ b/src/wine-host/bridges/group.cpp @@ -111,6 +111,11 @@ GroupBridge::GroupBridge(boost::filesystem::path group_socket_path) } GroupBridge::~GroupBridge() noexcept { + // Our fancy `Vst2Sockets` and `Vst3Sockets` clean up after themselves, but + // here we need to do it manually + // TODO: Encapsulate this, destructors are evil + fs::remove(group_socket_endpoint.path()); + stdio_context.stop(); } @@ -291,7 +296,7 @@ boost::asio::local::stream_protocol::acceptor create_acceptor_if_inactive( // process is already is already listening. In the last case we will // simply throw so the other process can handle the request. std::ifstream open_sockets("/proc/net/unix"); - std::string endpoint_path = endpoint.path(); + const std::string endpoint_path = endpoint.path(); for (std::string line; std::getline(open_sockets, line);) { if (line.size() < endpoint_path.size()) { continue; @@ -330,7 +335,13 @@ void GroupBridge::maybe_schedule_shutdown( "All plugins have exited, shutting down the group process"); // main_context.stop(); - // FIXME: See the comment in `individual-host.cpp` + // FIXME: See the comment in `individual-host.cpp`. Because of that + // we also need to manually clean up the socket endpoint. + // ...was there a reason why we can't do this terminate at + // the end of `group-host.cpp`? I don't think there is. Then + // we don't need to duplicate this nasty destructor + // behaviour. + fs::remove(group_socket_endpoint.path()); TerminateProcess(GetCurrentProcess(), 0); } });