]> git.ozlabs.org Git - petitboot/blobdiff - ui/twin/pbt-client.c
Increase X screen size
[petitboot] / ui / twin / pbt-client.c
index 1170b34555664c449fdbb12f0c3cdaf19541cc9b..bcd17c9153f60e590d8cbccffbbdeda490a39118 100644 (file)
@@ -63,8 +63,7 @@ static int pbt_client_run_kexec(struct pbt_item *item)
        result = item->pbt_client->kexec_cb(item->pbt_client, opt_data);
 
        if (!result) {
-               //mvaddstr(1, 0, "system is going down now...");
-               sleep(60);
+               sleep(item->pbt_client->dry_run ? 1 : 60);
        }
 
        pb_log("%s: failed: %s\n", __func__, opt_data->kd->image);
@@ -290,12 +289,12 @@ struct pbt_client *pbt_client_init(enum pbt_twin_backend backend,
                goto fail_scr_init;
 
        /* Loop here for scripts that just started the server. */
-if (1) {
-start_deamon:
-       for (i = 10; i; i--) {
+
+retry_start:
+       for (i = start_deamon ? 2 : 10; i; i--) {
                pbt_client->discover_client
                        = discover_client_init(&pbt_client_ops, pbt_client);
-               if (pbt_client->discover_client)
+               if (pbt_client->discover_client || !i)
                        break;
                pb_log("%s: waiting for server %d\n", __func__, i);
                sleep(1);
@@ -309,7 +308,7 @@ start_deamon:
                result = pb_start_daemon();
 
                if (!result)
-                       goto start_deamon;
+                       goto retry_start;
 
                pb_log("%s: discover_client_init failed.\n", __func__);
                fprintf(stderr, "%s: error: discover_client_init failed.\n",
@@ -331,7 +330,7 @@ start_deamon:
        waiter_register(discover_client_get_fd(pbt_client->discover_client),
                WAIT_IN, (waiter_cb)discover_client_process,
                pbt_client->discover_client);
-}
+
        return pbt_client;
 
 fail_client_init: