This commit is contained in:
2023-08-16 00:39:55 +08:00
parent fdfe210fef
commit c8f7a7dcb2
2 changed files with 28 additions and 1 deletions
+23
View File
@@ -37,6 +37,29 @@ class PoolItem
}
/**
* @return bool
*/
public function isClose(): bool
{
if ($this->_items instanceof Channel) {
return $this->_items->errCode == SWOOLE_CHANNEL_CLOSED;
}
return false;
}
/**
* @return void
*/
public function reconnect(): void
{
if ($this->_items instanceof Channel && $this->_items->errCode == SWOOLE_CHANNEL_CLOSED) {
$this->_items = new Channel($this->maxCreated);
}
}
/**
* @param Channel|SplQueue $items
*/