336cc875a1
This reverts commit fdf58326
42 lines
860 B
PHP
42 lines
860 B
PHP
<?php
|
|
|
|
namespace Kiri;
|
|
|
|
use JetBrains\PhpStorm\Pure;
|
|
|
|
trait TSwooleClient
|
|
{
|
|
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
#[Pure] private function settings(): array
|
|
{
|
|
$sslCert = $this->getSslCertFile();
|
|
$sslKey = $this->getSslKeyFile();
|
|
$sslCa = $this->getCa();
|
|
|
|
$params = [
|
|
'open_eof_check' => true,
|
|
'package_eof' => "\r\n\r\n",
|
|
'package_max_length' => 1024 * 1024 * 2,
|
|
];
|
|
if ($this->getConnectTimeout() > 0) {
|
|
$params['timeout'] = $this->getConnectTimeout();
|
|
}
|
|
if (empty($sslCert) || empty($sslKey) || empty($sslCa)) {
|
|
return $params;
|
|
}
|
|
|
|
$params['ssl_host_name'] = $this->getHost();
|
|
$params['ssl_cert_file'] = $this->getSslCertFile();
|
|
$params['ssl_key_file'] = $this->getSslKeyFile();
|
|
$params['ssl_verify_peer'] = TRUE;
|
|
$params['ssl_cafile'] = $sslCa;
|
|
|
|
return $params;
|
|
}
|
|
|
|
}
|