summaryrefslogtreecommitdiffstats
path: root/ui/twin
diff options
context:
space:
mode:
authorGeoff Levand <geoff@infradead.org>2012-03-30 17:20:48 -0700
committerGeoff Levand <geoff@infradead.org>2012-03-30 18:10:10 -0700
commitf4c558294089f7449e6f536300ddd1aa94d2cf20 (patch)
treea9a5585a7af753e1e4ddd04a00f3f0f43e91611c /ui/twin
parent52b9db95764fcdee9195113d7df225634a19c9f4 (diff)
downloadpetitboot-f4c558294089f7449e6f536300ddd1aa94d2cf20.zip
petitboot-f4c558294089f7449e6f536300ddd1aa94d2cf20.tar.gz
Speed up --start-daemon option
Signed-off-by: Geoff Levand <geoff@infradead.org>
Diffstat (limited to 'ui/twin')
-rw-r--r--ui/twin/pbt-client.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ui/twin/pbt-client.c b/ui/twin/pbt-client.c
index 8d7991a..bcd17c9 100644
--- a/ui/twin/pbt-client.c
+++ b/ui/twin/pbt-client.c
@@ -289,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);
@@ -308,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",
@@ -330,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:
OpenPOWER on IntegriCloud