Browse Source

Optimization

walkor 11 months ago
parent
commit
e48b41054d
1 changed files with 2 additions and 0 deletions
  1. 2 0
      src/Connection/AsyncTcpConnection.php

+ 2 - 0
src/Connection/AsyncTcpConnection.php

@@ -248,6 +248,7 @@ class AsyncTcpConnection extends TcpConnection
 
         $this->status = self::STATUS_CONNECTING;
         $this->connectStartTime = microtime(true);
+        set_error_handler(fn() => false);
         if ($this->transport !== 'unix') {
             if (!$this->remotePort) {
                 $this->remotePort = $this->transport === 'ssl' ? 443 : 80;
@@ -274,6 +275,7 @@ class AsyncTcpConnection extends TcpConnection
             $this->socket = stream_socket_client("$this->transport://$this->remoteAddress", $errno, $err_str, 0,
                 STREAM_CLIENT_ASYNC_CONNECT);
         }
+        restore_error_handler();
         // If failed attempt to emit onError callback.
         if (!$this->socket || !is_resource($this->socket)) {
             $this->emitError(static::CONNECT_FAIL, $err_str);