/** * Called on child processes after forking. * Starts accepting incoming connections. * * @param integer $slot The slot (numbered index) of the fork. * Reused when recreating process. * * @return void */ public function startChildProcess($slot) { // Some persistence providers (eg. MySQL) // should create a new connection when the process is forked. if ($this->persistence instanceof Persistence\ResetWhenForking) { $this->persistence->resetAfterForking(); } $this->logger->logMessage("Forked process on slot {$slot} starts accepting connections."); // Waiting for incoming connections. $this->communicationLoop(); }
/** * Called on child processes after forking. * * For slot 0: Starts seeding peer. * For slot 1: Starts announcing loop. * * @param integer $slot The slot (numbered index) of the fork. * Reused when recreating process. * * @throws Error * @return void */ public function startChildProcess($slot) { if ($this->persistence instanceof Persistence\ResetWhenForking) { $this->persistence->resetAfterForking(); } switch ($slot) { case 0: $this->peer->start(); break; case 1: $this->announce(); break; default: throw new Error('Invalid process slot while running seeder server.'); } }