Skip to content

Commit

Permalink
remove debug code.
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Mar 13, 2018
1 parent 4248c7b commit d405e9a
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions PhpAmqpLib/Wire/IO/SwooleIO.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function reconnect()

/**
* @param int $len
* @throws \PhpAmqpLib\Exception\AMQPIOException
* @throws \PhpAmqpLib\Exception\AMQPRuntimeException
* @return mixed|string
*/
public function read($len)
Expand All @@ -147,8 +147,7 @@ public function read($len)
{
$data = substr($this->buffer, 0, $len);
$this->buffer = substr($this->buffer, $len);

var_dump("recv: ".strlen($data));
$this->last_read = microtime(true);

return $data;
}
Expand All @@ -164,30 +163,16 @@ public function read($len)
throw new AMQPRuntimeException('Error receiving data, errno=' . $this->sock->errCode);
}

var_dump(strlen($read_buffer), $len);

//TODO 这里需要处理关闭事件
if ($read_buffer === '')
{
break;
continue;
}

$this->buffer .= $read_buffer;

} while (true);


// if (mb_strlen($data, 'ASCII') !== $len) {
// throw new AMQPRuntimeException(
// sprintf(
// 'Error reading data. Received %s instead of expected %s bytes',
// mb_strlen($data, 'ASCII'),
// $len
// )
// );
// }

$this->last_read = microtime(true);
return false;
}

Expand All @@ -201,8 +186,6 @@ public function write($data)
{
$buffer = $this->sock->send($data);

var_dump("send: ".strlen($data));

if ($buffer === false)
{
throw new AMQPRuntimeException('Error sending data');
Expand Down

0 comments on commit d405e9a

Please sign in to comment.