ソースを参照

Merge pull request #303 from ares333/patch1

Fix doSslHandshake() bug.
walkor 7 年 前
コミット
a908ef2237
2 ファイル変更4 行追加3 行削除
  1. 1 1
      Connection/AsyncTcpConnection.php
  2. 3 2
      Connection/TcpConnection.php

+ 1 - 1
Connection/AsyncTcpConnection.php

@@ -301,7 +301,7 @@ class AsyncTcpConnection extends TcpConnection
 
             // SSL handshake.
             if ($this->transport === 'ssl') {
-                $this->_sslHandshakeCompleted = $this->doSslHandshake($socket, true);
+                $this->_sslHandshakeCompleted = $this->doSslHandshake($socket);
             } else {
                 // There are some data waiting to send.
                 if ($this->_sendBuffer) {

+ 3 - 2
Connection/TcpConnection.php

@@ -565,7 +565,7 @@ class TcpConnection extends ConnectionInterface
     {
         // SSL handshake.
         if ($this->transport === 'ssl' && $this->_sslHandshakeCompleted !== true) {
-            if ($this->doSslHandshake($socket, false)) {
+            if ($this->doSslHandshake($socket)) {
                 $this->_sslHandshakeCompleted = true;
                 if ($this->_sendBuffer) {
                     Worker::$globalEvent->add($socket, EventInterface::EV_WRITE, array($this, 'baseWrite'));
@@ -715,11 +715,12 @@ class TcpConnection extends ConnectionInterface
      * @param $socket
      * @return bool
      */
-    public function doSslHandshake($socket, $async){
+    public function doSslHandshake($socket){
         if (feof($socket)) {
             $this->destroy();
             return false;
         }
+        $async=$this instanceof AsyncTcpConnection;
         if($async){
             $type=STREAM_CRYPTO_METHOD_SSLv2_CLIENT | STREAM_CRYPTO_METHOD_SSLv23_CLIENT;
         }else{