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.
This commit is contained in:
Robbert van der Helm
2021-10-16 01:58:15 +02:00
parent 3257b9c32e
commit 1b662c07a7
2 changed files with 19 additions and 2 deletions
+6
View File
@@ -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
+13 -2
View File
@@ -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);
}
});