protected function onPacket()
{
$this->result = $this->ptr;
if (!$this->subscribed) {
$this->resultType = !$this->resultTypeStack->isEmpty() ? $this->resultTypeStack->shift() : static::RESULT_TYPE_DEFAULT;
if ($this->resultType === static::RESULT_TYPE_ARGSVALS) {
$this->args = !$this->argsStack->isEmpty() ? $this->argsStack->shift() : [];
}
$this->onResponse->executeOne($this);
goto clean;
} elseif ($this->result[0] === 'message') {
$t =& $this->subscribeCb;
} elseif ($this->result[0] === 'pmessage') {
$t =& $this->psubscribeCb;
} else {
$this->resultType = !$this->resultTypeStack->isEmpty() ? $this->resultTypeStack->shift() : static::RESULT_TYPE_DEFAULT;
if ($this->resultType === static::RESULT_TYPE_ARGSVALS) {
$this->args = !$this->argsStack->isEmpty() ? $this->argsStack->shift() : [];
}
$this->onResponse->executeOne($this);
goto clean;
}
if (isset($t[$this->result[1]])) {
$this->resultType = static::RESULT_TYPE_MESSAGE;
$this->channel = $this->result[1];
$this->msg = $this->result[2];
foreach ($t[$this->result[1]] as $cb) {
if (is_callable($cb)) {
call_user_func($cb, $this);
}
}
} elseif ($this->pool->config->logpubsubracecondition->value) {
Daemon::log('[Redis client]' . ': PUB/SUB race condition at channel ' . Debug::json($this->result[1]));
}
clean:
$this->args = null;
$this->result = null;
$this->channel = null;
$this->msg = null;
$this->error = false;
$this->pos = 0;
$this->resultType = static::RESULT_TYPE_DEFAULT;
$this->assocData = null;
if (!isset($t)) {
$this->checkFree();
}
}