/** * @param string $id * @param Ustream_Daemon_Config $config */ public function __construct($id, Ustream_Daemon_Config $config) { if ($config->customDaemonUtilLogFile !== null) { $this->daemonUtilLogFile = $config->customDaemonUtilLogFile; } parent::__construct(); $this->id = $id; $this->useMultipleInstances = $config->multipleInstances; $this->config = $config; $this->forceDirectory = $this->config->logDir; $context = $config->context; $this->setPidFileLocation('%s/%s-%s.pid', $config->runDir, $this->id, $context); $this->setLogFile(sprintf('%s/%s', $config->logDir, $this->id), $context); $this->sleepBetweenRuns = $config->sleepBetweenRuns; $this->minimumSleep = $config->minimumSleep; $this->memoryThreshold = $config->memoryThreshold; $eventListeners = $config->listeners; $this->addListeners($eventListeners); }