Dispatch message to worker by name
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user