diff --git a/system/Process/Process.php b/system/Process/Process.php index 6519fdf1..07599b53 100644 --- a/system/Process/Process.php +++ b/system/Process/Process.php @@ -6,6 +6,9 @@ namespace Snowflake\Process; use Snowflake\Abstracts\Component; use Snowflake\Application; +use Snowflake\Exception\ComponentException; +use Swoole\Coroutine\Socket; +use Swoole\Process\Pool; /** * Class Process @@ -37,6 +40,17 @@ abstract class Process extends Component abstract public function onHandler(\Swoole\Process $process); + /** + * @param $workerId + * @return Socket + * @throws ComponentException + */ + protected function exportSocket($workerId) + { + return $this->application->get(Pool::class)->getProcess(1)->exportSocket(); + } + + /** */ protected function start()