mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-22 08:05:34 +08:00
prerelease of beta1
This commit is contained in:
@@ -49,6 +49,7 @@ class ConnectionUtil
|
||||
*/
|
||||
public static function setConnection(int $fd, array $handle): void
|
||||
{
|
||||
logger()->notice('设置连接情况:' . json_encode($handle));
|
||||
self::$connection_handles[$fd] = array_merge(self::$connection_handles[$fd] ?? [], $handle);
|
||||
// 这里下面为连接准入,允许接入反向 WS
|
||||
if (ProcessStateManager::$process_mode['worker'] > 1) {
|
||||
@@ -72,4 +73,15 @@ class ConnectionUtil
|
||||
@unlink(zm_dir(ZM_STATE_DIR . '/.WS' . $fd . '.' . ProcessManager::getProcessId()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取记录连接内容的特殊信息
|
||||
*
|
||||
* @param int $fd WS 连接 ID
|
||||
* @return null|mixed
|
||||
*/
|
||||
public static function getConnection(int $fd)
|
||||
{
|
||||
return self::$connection_handles[$fd] ?? null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user