diff --git a/guestfs-inspectd.c b/guestfs-inspectd.c index 68e0e56..5692774 100644 --- a/guestfs-inspectd.c +++ b/guestfs-inspectd.c @@ -4,6 +4,8 @@ #include #include +#define STREQ(a, b) (strcmp((a), (b)) == 0) + void *worker_task; char *endpoint(void); @@ -25,14 +27,29 @@ int main(int argc, char **argv) { for (int i = 0; i < worker_count; i++) { char *path = strtok(argv[i+1], ":"); worker_map[i].name = strtok(NULL, ":"); - zactor_new(worker_map[i].worker, (void *) &((struct { char* path; char *name; }) {.path = path, .name = name})); + zactor_new(worker_map[i].worker, path); } char *ep = endpoint(); zsock_t *frontend = zsock_new_router(ep); - free(ep); + while (true) { + zmsg_t *msg = zmsg_recv(frontend); + + if (!msg) break; + + // Find the worker with the given name. + zactor_t *worker = NULL; + for (int i = 0; i < worker_count; i++) { + + } + if (worker) { + zmsg_send(&msg, zactor_sock(worker)); + } else { + // The name specified does not exist. + } + } return EXIT_SUCCESS; }