diff options
Diffstat (limited to 'src/dbus.c')
-rw-r--r-- | src/dbus.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -512,14 +512,19 @@ method_try(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) // LCOV_EXCL_STOP /* wait for the /run/netplan/netplan-try.ready stamp file to appear */ - guint poll_timeout = 500; - if (seconds > 0 && seconds < 5) + guint poll_timeout = 1000; + /* Replace the default timeout with the one specified by the caller */ + if (seconds > 0) poll_timeout = seconds * 100; - /* Timeout after up to 5 sec of waiting for the stamp file */ + /* Timeout after up to 10 sec of waiting for the stamp file */ for (int i = 0; i < poll_timeout; i++) { + struct timespec timeout = { + .tv_sec = 0, + .tv_nsec = 1000 * 1000 * 10, // 10 ms + }; if (stat(netplan_try_stamp, &buf) == 0) break; - usleep(1000 * 10); + nanosleep(&timeout, NULL); } if (stat(netplan_try_stamp, &buf) != 0) { g_debug("cannot find %s stamp file", netplan_try_stamp); |