in consumer/fsof/FSOFProcessor.php [306:345]
protected function Recv($socket, $len)
{
try
{
$start_time = microtime(true);
$resv_len = $len;
$_data = '';
do
{
$tmp_data = $socket->recv($resv_len);
if (!$tmp_data)
{
$this->logger->warn("socket->recv faile:$resv_len");
break;
}
$_data .= $tmp_data;
$resv_len -= strlen($tmp_data);
} while (($resv_len > 0) && ( (microtime(true) - $start_time) < $this->iotimeout)); //读取数据不能超过设置的io时长
if ($resv_len > 0)
{
$this->logger->error("Recv $len data fail!");
return FALSE;
}
return $_data;
}
catch (\Exception $e)
{
$this->logger->error('recv data exception',$e);
if(self::FSOF_CONNECTION_RESET == $e->getCode())
{
throw new ConsumerException("未知异常");
}
else
{
throw new ConsumerException("接收应答数据超时");
}
}
}