Dispatch message to worker by name

This commit is contained in:
2024-03-03 00:03:19 -05:00
parent 26c742f017
commit 73d8b6716b

View File

@@ -145,13 +145,18 @@ int main(int argc, char **argv) {
// Find the worker with the given name.
zactor_t *worker = NULL;
struct guestfs_inpsect_command *cmd = (struct guestfs_inpsect_command *) zmsg_last(msg);
for (int i = 0; i < worker_count; i++) {
if (STREQ(cmd->name, worker_map[i].name)) {
worker = worker_map[i].name;
break;
}
}
if (worker) {
zmsg_send(&msg, zactor_sock(worker));
} else {
// The name specified does not exist.
printf("There is no drive with the name %s\n.", cmd->name);
}
}
return EXIT_SUCCESS;