Fix issue with closing sockets in plugin groups

As per Boost.Asio's manual, an explicit `socket.shutdown()` is needed
before calling `close()`. For some reason this worked fine in almost
every situation, but when hosting both a plugin hosted within a group
host process and a normal individually hosted plugin within a single
process, and then removing those two plugins in order, the
`host_vst_dispatch` socket of the first plugin never got closed. This
would hang the entire shutdown sequence to hang on the
`dispatch_handler` jthread.

First discovered in #45
This commit is contained in:
Robbert van der Helm
2020-10-22 14:05:59 +02:00
parent ce385f39d3
commit db02fa1c43
2 changed files with 5 additions and 0 deletions
+3
View File
@@ -14,6 +14,9 @@ Versioning](https://semver.org/spec/v2.0.0.html).
errors and crash yabridge. errors and crash yabridge.
- Fixed a regression where certain fake dropdown menus such as those used in the - Fixed a regression where certain fake dropdown menus such as those used in the
Tokyo Dawn Records plugins would close immediately when hovering over them. Tokyo Dawn Records plugins would close immediately when hovering over them.
- Fixed an issue where plugins hosted within a plugin group would not shut down
properly in certain situations. This would cause the VST host to hang while
removing such a plugin.
### yabridgectl ### yabridgectl
+2
View File
@@ -262,5 +262,7 @@ void GroupHost::terminate() {
// There's no need to manually terminate group host processes as they will // There's no need to manually terminate group host processes as they will
// shut down automatically after all plugins have exited. Manually closing // shut down automatically after all plugins have exited. Manually closing
// the dispatch socket will cause the associated plugin to exit. // the dispatch socket will cause the associated plugin to exit.
host_vst_dispatch.shutdown(
boost::asio::local::stream_protocol::socket::shutdown_both);
host_vst_dispatch.close(); host_vst_dispatch.close();
} }