protected function commandRegister(array $data, Connection $conn)
{
$pid = (int) $data['pid'];
$port = (int) $data['port'];
if (!isset($this->slaves[$port]) || !$this->slaves[$port]['waitForRegister']) {
if ($this->output->isVeryVerbose()) {
$this->output->writeln(sprintf('<error>Worker #%d wanted to register on master which was not expected.</error>', $port));
}
$conn->close();
return;
}
$this->ports[spl_object_hash($conn)] = $port;
if ($this->output->isVeryVerbose()) {
$this->output->writeln(sprintf('Worker #%d registered. Waiting for application bootstrap ... ', $port));
}
$this->slaves[$port]['pid'] = $pid;
$this->slaves[$port]['connection'] = $conn;
$this->slaves[$port]['ready'] = false;
$this->slaves[$port]['waitForRegister'] = false;
$this->slaves[$port]['duringBootstrap'] = true;
$this->sendMessage($conn, 'bootstrap');
}