diff options
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; |