diff options
author | Simon Rettberg | 2020-05-15 17:23:25 +0200 |
---|---|---|
committer | Simon Rettberg | 2020-05-15 17:23:25 +0200 |
commit | c04a082d57ab8c2088e6ae9ed1e83c1335f1d7e6 (patch) | |
tree | a56318cada84a080657ed7879524a7764714c42b /modules-available | |
parent | [rebootcontrol] Cleanup, TODO (diff) | |
download | slx-admin-c04a082d57ab8c2088e6ae9ed1e83c1335f1d7e6.tar.gz slx-admin-c04a082d57ab8c2088e6ae9ed1e83c1335f1d7e6.tar.xz slx-admin-c04a082d57ab8c2088e6ae9ed1e83c1335f1d7e6.zip |
[rebootcontrol] Wait until tasks finish
Diffstat (limited to 'modules-available')
-rw-r--r-- | modules-available/rebootcontrol/hooks/cron.inc.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/modules-available/rebootcontrol/hooks/cron.inc.php b/modules-available/rebootcontrol/hooks/cron.inc.php index 8a839767..93f2de38 100644 --- a/modules-available/rebootcontrol/hooks/cron.inc.php +++ b/modules-available/rebootcontrol/hooks/cron.inc.php @@ -82,6 +82,11 @@ function testClientToClient($srcid, $dstid) usleep(250000); $destTask = Taskmanager::status($destTask); } + // Wait for destination listener task to finish; we might want to reuse that client, + // and trying to spawn a new listener while the old one is running will fail + for ($to = 0; $to < 30 && Taskmanager::isRunning($destTask); ++$to) { + usleep(250000); + } cron_log($destTask['data']['result'][$destMachine['machineuuid']]['stdout']); // Final moment: did dest see the packets from src? Determine this by looking for the generated password if (destSawPw($destTask, $destMachine, $passwd)) @@ -108,6 +113,11 @@ function testServerToClient($dstid) $task = Taskmanager::waitComplete($task, 2000); $destTask = Taskmanager::status($destTask); } + // Wait for destination listener task to finish; we might want to reuse that client, + // and trying to spawn a new listener while the old one is running will fail + for ($to = 0; $to < 30 && Taskmanager::isRunning($destTask); ++$to) { + usleep(250000); + } cron_log($destTask['data']['result'][$destMachine['machineuuid']]['stdout']); if (destSawPw($destTask, $destMachine, $passwd)) return 1; |