改名
This commit is contained in:
@@ -47,7 +47,9 @@ class OnPacket extends Callback
|
|||||||
|
|
||||||
$dispatch = $node->dispatch();
|
$dispatch = $node->dispatch();
|
||||||
if (!is_string($dispatch)) $dispatch = Json::encode($dispatch);
|
if (!is_string($dispatch)) $dispatch = Json::encode($dispatch);
|
||||||
|
if (empty($dispatch)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return $server->sendto($host, $port, $dispatch);
|
return $server->sendto($host, $port, $dispatch);
|
||||||
} catch (\Throwable $exception) {
|
} catch (\Throwable $exception) {
|
||||||
$this->addError($exception, 'packet');
|
$this->addError($exception, 'packet');
|
||||||
|
|||||||
@@ -41,10 +41,11 @@ class OnReceive extends Callback
|
|||||||
if (($node = $router->find_path($request)) === null) {
|
if (($node = $router->find_path($request)) === null) {
|
||||||
return $server->send($fd, Json::encode(['state' => 404]));
|
return $server->send($fd, Json::encode(['state' => 404]));
|
||||||
}
|
}
|
||||||
|
|
||||||
$dispatch = $node->dispatch();
|
$dispatch = $node->dispatch();
|
||||||
if (!is_string($dispatch)) $dispatch = Json::encode($dispatch);
|
if (!is_string($dispatch)) $dispatch = Json::encode($dispatch);
|
||||||
|
if (empty($dispatch)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return $server->send($fd, $dispatch);
|
return $server->send($fd, $dispatch);
|
||||||
} catch (\Throwable $exception) {
|
} catch (\Throwable $exception) {
|
||||||
$this->addError($exception, 'receive');
|
$this->addError($exception, 'receive');
|
||||||
|
|||||||
Reference in New Issue
Block a user