mirror of
https://gitlab.freedesktop.org/plymouth/plymouth.git
synced 2026-05-05 12:18:00 +02:00
client: Don't wait forever for a ping reply
In the event that plymouthd is not responding the plymouth client will wait forever when sending a ping to the daemon. This commit introduces a timeout of 30 seconds to better cope with a hung plymouthd process. (Some small changes to original patch by Ray Strode) https://gitlab.freedesktop.org/plymouth/plymouth/-/issues/130
This commit is contained in:
parent
03e7789503
commit
53c83cc8d6
1 changed files with 16 additions and 0 deletions
|
|
@ -42,6 +42,12 @@
|
|||
#define PLY_MAX_COMMAND_LINE_SIZE 4097
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef PLY_PING_TIMEOUT
|
||||
#define PLY_PING_TIMEOUT 30.0
|
||||
#endif
|
||||
|
||||
|
||||
#define KEY_CTRL_C ('\100' ^ 'C')
|
||||
|
||||
typedef struct
|
||||
|
|
@ -75,6 +81,13 @@ typedef struct
|
|||
char *keys;
|
||||
} key_answer_state_t;
|
||||
|
||||
static void
|
||||
on_ping_timeout (state_t *state)
|
||||
{
|
||||
ply_trace ("ping: timed out waiting for plymouthd");
|
||||
ply_event_loop_exit (state->loop, 1);
|
||||
}
|
||||
|
||||
static char **
|
||||
split_string (const char *command,
|
||||
const char delimiter)
|
||||
|
|
@ -1145,6 +1158,9 @@ main (int argc,
|
|||
on_success,
|
||||
(ply_boot_client_response_handler_t)
|
||||
on_failure, &state);
|
||||
ply_event_loop_watch_for_timeout (state.loop, PLY_PING_TIMEOUT,
|
||||
(ply_event_loop_timeout_handler_t)
|
||||
on_ping_timeout, &state);
|
||||
} else if (should_check_for_active_vt) {
|
||||
ply_boot_client_ask_daemon_has_active_vt (state.client,
|
||||
(ply_boot_client_response_handler_t)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue