改名
This commit is contained in:
@@ -17,46 +17,4 @@ use Swoole\Process\Pool;
|
|||||||
abstract class Process extends Component
|
abstract class Process extends Component
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var Application */
|
|
||||||
protected $application;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Process constructor.
|
|
||||||
* @param $application
|
|
||||||
* @param array $config
|
|
||||||
*/
|
|
||||||
public function __construct(Application $application, $config = [])
|
|
||||||
{
|
|
||||||
$this->application = $application;
|
|
||||||
parent::__construct([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param \Swoole\Process $process
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
abstract public function onHandler(\Swoole\Process $process);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $workerId
|
|
||||||
* @return Socket
|
|
||||||
* @throws ComponentException
|
|
||||||
*/
|
|
||||||
protected function exportSocket($workerId)
|
|
||||||
{
|
|
||||||
return $this->application->get(Pool::class)->getProcess($workerId)->exportSocket();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
protected function start()
|
|
||||||
{
|
|
||||||
$_process = new \Swoole\Process([$this, 'onHandler'], false, null, true);
|
|
||||||
$_process->start();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user