return 0;
}
-/**
- * cui_client_process_socket - Process a socket event from the discover server.
- */
-
-static int cui_client_process_socket(void *arg)
-{
- struct discover_client *client = arg;
-
- discover_client_process(client);
- return 0;
-}
/**
* cui_handle_timeout - Handle the timeout.
int (*js_map)(const struct js_event *e), int start_deamon, int dry_run)
{
struct cui *cui;
- struct discover_client *client;
unsigned int i;
cui = talloc_zero(NULL, struct cui);
retry_start:
for (i = start_deamon ? 2 : 10; i; i--) {
- client = discover_client_init(&cui_client_ops, cui);
- if (client || !i)
+ cui->client = discover_client_init(cui->waitset,
+ &cui_client_ops, cui);
+ if (cui->client || !i)
break;
pb_log("%s: waiting for server %d\n", __func__, i);
sleep(1);
}
- if (!client && start_deamon) {
+ if (!cui->client && start_deamon) {
int result;
start_deamon = 0;
goto fail_client_init;
}
- if (!client) {
+ if (!cui->client) {
pb_log("%s: discover_client_init failed.\n", __func__);
fprintf(stderr, "%s: error: discover_client_init failed.\n",
__func__);
atexit(nc_atexit);
nc_start();
- waiter_register(cui->waitset, discover_client_get_fd(client), WAIT_IN,
- cui_client_process_socket, client);
-
waiter_register(cui->waitset, STDIN_FILENO, WAIT_IN,
cui_process_key, cui);