改名
This commit is contained in:
@@ -39,17 +39,16 @@ class OnPacket extends Callback
|
||||
public function onHandler(Server $server, string $data, array $clientInfo)
|
||||
{
|
||||
try {
|
||||
$client = [$clientInfo['address'], $clientInfo['port']];
|
||||
$data = DataResolve::unpack($this->unpack, $clientInfo['address'], $clientInfo['port'], $data);
|
||||
if (empty($data)) {
|
||||
throw new Exception('Format error.');
|
||||
}
|
||||
$client[] = DataResolve::pack($this->pack, $data);
|
||||
return $server->sendto(...$client);
|
||||
$client = DataResolve::pack($this->pack, $data);
|
||||
return $server->sendto($clientInfo['address'], $clientInfo['port'], $client ?? 'Format error');
|
||||
} catch (\Throwable $exception) {
|
||||
$client[] = DataResolve::pack($this->pack, $exception->getMessage());
|
||||
var_dump($client);
|
||||
return $server->sendto(...$client);
|
||||
$client = DataResolve::pack($this->pack, $exception->getMessage());
|
||||
|
||||
return $server->sendto($clientInfo['address'], $clientInfo['port'], $client ?? 'Format error');
|
||||
} finally {
|
||||
$event = Snowflake::app()->event;
|
||||
$event->trigger(Event::SERVER_WORKER_STOP);
|
||||
|
||||
Reference in New Issue
Block a user