This commit is contained in:
as2252258@163.com
2021-07-18 01:01:29 +08:00
parent 51c3637ed2
commit a5b2445ec2
3 changed files with 250 additions and 281 deletions
+2 -19
View File
@@ -153,28 +153,11 @@ class BASEServerListener
$customProcess = new $customProcess($this->server);
}
/** @var Process $process */
$process = $this->server->addProcess(
new Process(
function (Process $soloProcess) use ($customProcess) {
$this->server->addProcess(new Process(function (Process $soloProcess) use ($customProcess) {
$soloProcess->name($customProcess->getProcessName($soloProcess));
/** @var \Swoole\Coroutine\Socket $export */
$export = $soloProcess->exportSocket();
loop(function () use ($export, $customProcess) {
$read = $export->recv();
if (!empty($read)) {
$customProcess->receive($read);
}
});
$customProcess->onHandler($soloProcess);
},
$redirect_stdin_and_stdout,
$pipe_type,
$enable_coroutine
)
);
/** @var \Swoole\Coroutine\Socket $socket */
$socket = $process->exportSocket();
$socket->send("");
$redirect_stdin_and_stdout, $pipe_type, $enable_coroutine));
}
-5
View File
@@ -28,10 +28,5 @@ interface CustomProcess
public function onHandler(Process $process): void;
/**
* @param mixed $data
*/
public function receive(mixed $data): void;
}
-9
View File
@@ -31,15 +31,6 @@ class RelationshipSystemProcess implements CustomProcess
}
/**
* @param mixed $data
*/
public function receive(mixed $data): void
{
}
/**
*
*/