mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Fix interleaved group host initialization
In case two yabridge instances start at the same time and both try to launch a group host for the same group and the second plugin connects to the first group host, then we should of course be using that process'es PID to check if the group host is still running.
This commit is contained in:
@@ -720,6 +720,8 @@ void PluginBridge::launch_vst_host() {
|
||||
// TODO: Replace this polling with inotify when encapsulating
|
||||
// the different host launch behaviors
|
||||
while (vst_host.running()) {
|
||||
std::this_thread::sleep_for(20ms);
|
||||
|
||||
try {
|
||||
// This is the exact same connection sequence as above
|
||||
boost::asio::local::stream_protocol::socket group_socket(
|
||||
@@ -729,11 +731,14 @@ void PluginBridge::launch_vst_host() {
|
||||
write_object(group_socket,
|
||||
GroupRequest{plugin_path.string(),
|
||||
socket_path.string()});
|
||||
read_object<GroupResponse>(group_socket);
|
||||
const auto response =
|
||||
read_object<GroupResponse>(group_socket);
|
||||
|
||||
// If two group processes started at the same time, than the
|
||||
// first one will be the one to respond to the host request
|
||||
vst_host_pid = response.pid;
|
||||
return;
|
||||
} catch (const boost::system::system_error&) {
|
||||
std::this_thread::sleep_for(20ms);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user