mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-11-30 10:47:44 +08:00
commit
a9a0279d8a
@ -9,6 +9,10 @@
|
||||
|
||||
[#545](https://github.com/hyperf-cloud/hyperf/pull/545) Deleted useless static methods `restoring` and `restored` of trait SoftDeletes.
|
||||
|
||||
## Optimized
|
||||
|
||||
[#549](https://github.com/hyperf-cloud/hyperf/pull/549) Optimized `read` and `write` of `Hyperf\Amqp\Connection\SwooleIO`.
|
||||
|
||||
# v1.0.14 - 2019-09-05
|
||||
|
||||
## Added
|
||||
|
@ -158,7 +158,6 @@ class SwooleIO extends AbstractIO
|
||||
public function read($len)
|
||||
{
|
||||
$this->check_heartbeat();
|
||||
$count = 0;
|
||||
do {
|
||||
if ($len <= strlen($this->buffer)) {
|
||||
$data = substr($this->buffer, 0, $len);
|
||||
@ -178,10 +177,7 @@ class SwooleIO extends AbstractIO
|
||||
}
|
||||
|
||||
if ($read_buffer === '') {
|
||||
if (5 < $count++) {
|
||||
throw new AMQPRuntimeException('The receiving data is empty, errno=' . $this->sock->errCode);
|
||||
}
|
||||
continue;
|
||||
throw new AMQPRuntimeException('Connection is closed.');
|
||||
}
|
||||
|
||||
$this->buffer .= $read_buffer;
|
||||
@ -192,8 +188,8 @@ class SwooleIO extends AbstractIO
|
||||
|
||||
/**
|
||||
* @param string $data
|
||||
* @throws AMQPRuntimeException
|
||||
* @throws \PhpAmqpLib\Exception\AMQPTimeoutException
|
||||
* @throws AMQPRuntimeException
|
||||
* @return mixed|void
|
||||
*/
|
||||
public function write($data)
|
||||
@ -204,10 +200,6 @@ class SwooleIO extends AbstractIO
|
||||
throw new AMQPRuntimeException('Error sending data');
|
||||
}
|
||||
|
||||
if ($buffer === 0 && ! $this->sock->connected) {
|
||||
throw new AMQPRuntimeException('Broken pipe or closed connection');
|
||||
}
|
||||
|
||||
$this->lastWrite = microtime(true);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user