Explorar o código

Update AsyncTcpConnection.php

walkor %!s(int64=7) %!d(string=hai) anos
pai
achega
9db5b06274
Modificáronse 1 ficheiros con 7 adicións e 7 borrados
  1. 7 7
      Connection/AsyncTcpConnection.php

+ 7 - 7
Connection/AsyncTcpConnection.php

@@ -288,15 +288,18 @@ class AsyncTcpConnection extends TcpConnection
      */
     public function checkConnection()
     {
-        if ($this->_status != self::STATUS_CONNECTING) {
-            return;
-        }
-
         // Remove EV_EXPECT for windows.
         if(DIRECTORY_SEPARATOR === '\\') {
             Worker::$globalEvent->del($this->_socket, EventInterface::EV_EXCEPT);
         }
 
+        // Remove write listener.
+        Worker::$globalEvent->del($this->_socket, EventInterface::EV_WRITE);
+
+        if ($this->_status != self::STATUS_CONNECTING) {
+            return;
+        }
+
         // Check socket state.
         if ($address = stream_socket_get_name($this->_socket, true)) {
             // Nonblocking.
@@ -312,9 +315,6 @@ class AsyncTcpConnection extends TcpConnection
                 socket_set_option($raw_socket, SOL_TCP, TCP_NODELAY, 1);
             }
 
-            // Remove write listener.
-            Worker::$globalEvent->del($this->_socket, EventInterface::EV_WRITE);
-
             // SSL handshake.
             if ($this->transport === 'ssl') {
                 $this->_sslHandshakeCompleted = $this->doSslHandshake($this->_socket);