This commit is contained in:
2021-12-11 16:43:07 +08:00
parent 80a2db8974
commit 9d24b3314b
+6 -3
View File
@@ -77,13 +77,16 @@ class AsyncClient extends ClientAbstracts
* @param $host
* @param $isHttps
* @param $path
* @throws Exception
*/
private function generate_client($data, $host, $isHttps, $path): void
{
$this->client = new SwowClient(SWOOLE_TCP, TRUE);
if ($isHttps || $this->isSSL()) {
$this->client = new SwowClient($host, 443, TRUE);
} else {
$this->client = new SwowClient($host, $this->getPort(), FALSE);
$this->client->enableSSL();
}
if (!$this->client->connect($host, $this->getPort())) {
throw new Exception('链接失败');
}
$this->client->set($this->settings());
if (!empty($this->getAgent())) {