提交 1d1a24be 编写于 作者: weixin_47267244's avatar weixin_47267244

优化 amqp 心跳及发送错误的异常

上级 0f800a8b
......@@ -183,7 +183,7 @@ class SwooleIO extends AbstractIO
if (false === $buffer)
{
throw new AMQPRuntimeException('Error sending data, errno=' . $this->sock->errCode);
throw new AMQPConnectionClosedException('Error sending data, errno=' . $this->sock->errCode);
}
if (0 === $buffer && !$this->sock->connected)
......@@ -228,8 +228,6 @@ class SwooleIO extends AbstractIO
*/
protected function do_select($sec, $usec)
{
$this->check_heartbeat();
return 1;
}
......@@ -240,7 +238,7 @@ class SwooleIO extends AbstractIO
$this->heartbeatTimerId = \Swoole\Timer::tick($this->heartbeat * 1000, function () {
if ($this->sock && $this->sock->isConnected())
{
$this->check_heartbeat();
$this->write_heartbeat();
}
});
}
......@@ -254,4 +252,13 @@ class SwooleIO extends AbstractIO
$this->heartbeatTimerId = null;
}
}
/**
* Heartbeat logic: check connection health here
* @return void
* @throws \PhpAmqpLib\Exception\AMQPRuntimeException
*/
public function check_heartbeat()
{
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册