Rename GroupRequest to HostRequest

We'll also use this to encode information in when launching
`yabridge-host.exe` for individually hosted plugins.
This commit is contained in:
Robbert van der Helm
2020-11-30 23:15:42 +01:00
parent 1c5a9423d2
commit e21d3e020f
5 changed files with 16 additions and 16 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ enum class LibArchitecture { dll_32, dll_64 };
* `plugin_tyep_to_string()` and `plugin_type_from_string()` can be used to * `plugin_tyep_to_string()` and `plugin_type_from_string()` can be used to
* convert these values to and from strings. The string form is used as a * convert these values to and from strings. The string form is used as a
* command line argument for the individual Wine host applications, and the enum * command line argument for the individual Wine host applications, and the enum
* form is passed directly in `GroupRequest`. * form is passed directly in `HostRequest`.
* *
* The `unkonwn` tag is not used directly, but in the event that we do call * The `unkonwn` tag is not used directly, but in the event that we do call
* `plugin_type_from_string()` with some invalid value we can use it to * `plugin_type_from_string()` with some invalid value we can use it to
+8 -8
View File
@@ -51,11 +51,11 @@ template <class... Ts>
overload(Ts...) -> overload<Ts...>; overload(Ts...) -> overload<Ts...>;
/** /**
* An object containing the startup options for hosting a plugin in a plugin * An object containing the startup options for hosting a plugin. These options
* group process. These are the exact same options that would have been passed * are passed to `yabridge-host.exe` as command line arguments, and they are
* to `yabridge-host.exe` were the plugin to be hosted individually. * used directly by group host processes.
*/ */
struct GroupRequest { struct HostRequest {
PluginType plugin_type; PluginType plugin_type;
std::string plugin_path; std::string plugin_path;
std::string endpoint_base_dir; std::string endpoint_base_dir;
@@ -69,8 +69,8 @@ struct GroupRequest {
}; };
template <> template <>
struct std::hash<GroupRequest> { struct std::hash<HostRequest> {
std::size_t operator()(GroupRequest const& params) const noexcept { std::size_t operator()(HostRequest const& params) const noexcept {
std::hash<string> hasher{}; std::hash<string> hasher{};
return hasher(params.plugin_path) ^ return hasher(params.plugin_path) ^
@@ -79,12 +79,12 @@ struct std::hash<GroupRequest> {
}; };
/** /**
* The response sent back after the group host process receives a `GroupRequest` * The response sent back after the group host process receives a `HostRequest`
* object. This only holds the group process's PID because we need to know if * object. This only holds the group process's PID because we need to know if
* the group process crashes while it is initializing the plugin to prevent us * the group process crashes while it is initializing the plugin to prevent us
* from waiting indefinitely for the socket to be connected to. * from waiting indefinitely for the socket to be connected to.
*/ */
struct GroupResponse { struct HostResponse {
pid_t pid; pid_t pid;
template <typename S> template <typename S>
+4 -4
View File
@@ -183,10 +183,10 @@ GroupHost::GroupHost(boost::asio::io_context& io_context,
write_object( write_object(
group_socket, group_socket,
// TODO: The plugin type should of course not be hardcoded // TODO: The plugin type should of course not be hardcoded
GroupRequest{.plugin_type = PluginType::vst2, HostRequest{.plugin_type = PluginType::vst2,
.plugin_path = plugin_path.string(), .plugin_path = plugin_path.string(),
.endpoint_base_dir = endpoint_base_dir.string()}); .endpoint_base_dir = endpoint_base_dir.string()});
const auto response = read_object<GroupResponse>(group_socket); const auto response = read_object<HostResponse>(group_socket);
assert(response.pid > 0); assert(response.pid > 0);
}; };
+2 -2
View File
@@ -184,8 +184,8 @@ void GroupBridge::accept_requests() {
// TODO: Do something with the plugin type // TODO: Do something with the plugin type
// TODO: Maybe try to merge instantiation with `individual_host`? // TODO: Maybe try to merge instantiation with `individual_host`?
// Might only make things messier // Might only make things messier
const auto request = read_object<GroupRequest>(socket); const auto request = read_object<HostRequest>(socket);
write_object(socket, GroupResponse{boost::this_process::get_id()}); write_object(socket, HostResponse{boost::this_process::get_id()});
// The plugin has to be initiated on the IO context's thread because // The plugin has to be initiated on the IO context's thread because
// this has to be done on the same thread that's handling messages, // this has to be done on the same thread that's handling messages,
+1 -1
View File
@@ -68,7 +68,7 @@ class Vst2Bridge {
* or if communication could not be set up. * or if communication could not be set up.
* *
* TODO: Make these two arguments `boost::filesystem::path`, also use those * TODO: Make these two arguments `boost::filesystem::path`, also use those
* in `GroupRequest`. * in `HostRequest`.
*/ */
Vst2Bridge(MainContext& main_context, Vst2Bridge(MainContext& main_context,
std::string plugin_dll_path, std::string plugin_dll_path,