|
26 | 26 | use IO\Github\Wechaty\PuppetService\Exceptions\PuppetServiceException;
|
27 | 27 | use IO\Github\Wechaty\Util\Console;
|
28 | 28 | use IO\Github\Wechaty\Util\Logger;
|
| 29 | +use LM\Exception; |
29 | 30 | use Wechaty\Puppet\ContactPayloadResponse;
|
30 | 31 | use Wechaty\Puppet\EventResponse;
|
31 | 32 | use Wechaty\Puppet\EventType;
|
@@ -797,18 +798,23 @@ function ($metadata,
|
797 | 798 | // WECHATY_PUPPET_SERVICE_TLS_CA_CERT
|
798 | 799 | // WECHATY_PUPPET_SERVICE_TLS_SERVER_NAME
|
799 | 800 | $noTls = getenv("WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_CLIENT");
|
800 |
| - if($noTls === "true" || $noTls === true) { |
801 |
| - Logger::DEBUG("start client with no tls"); |
802 |
| - $this->_grpcClient = new \Wechaty\PuppetClient($hostname, [ |
803 |
| - 'credentials' => \Grpc\ChannelCredentials::createInsecure(), |
804 |
| - 'update_metadata' => $updateMetadata, |
805 |
| - ]); |
806 |
| - } else { |
807 |
| - Logger::DEBUG("start client with tls"); |
808 |
| - $this->_grpcClient = new \Wechaty\PuppetClient($hostname, [ |
809 |
| - 'credentials' => \Grpc\ChannelCredentials::createSsl(WechatyCA::TLS_CA_CERT), |
810 |
| - 'update_metadata' => $updateMetadata, |
811 |
| - ]); |
| 801 | + try { |
| 802 | + if($noTls === "true" || $noTls === true) { |
| 803 | + Logger::DEBUG("start client with no tls"); |
| 804 | + $this->_grpcClient = new \Wechaty\PuppetClient($hostname, [ |
| 805 | + 'credentials' => \Grpc\ChannelCredentials::createInsecure(), |
| 806 | + 'update_metadata' => $updateMetadata, |
| 807 | + ]); |
| 808 | + } else { |
| 809 | + Logger::DEBUG("start client with tls"); |
| 810 | + $this->_grpcClient = new \Wechaty\PuppetClient($hostname, [ |
| 811 | + 'credentials' => \Grpc\ChannelCredentials::createSsl(WechatyCA::TLS_CA_CERT), |
| 812 | + 'update_metadata' => $updateMetadata, |
| 813 | + ]); |
| 814 | + } |
| 815 | + } catch (\Exception $e) { |
| 816 | + Logger::ERR("start client error"); |
| 817 | + Logger::ERR($e); |
812 | 818 | }
|
813 | 819 |
|
814 | 820 | return $this->_grpcClient;
|
|
0 commit comments