Explorar o código

_id => realId

walkor %!s(int64=2) %!d(string=hai) anos
pai
achega
7268ae91cf
Modificáronse 2 ficheiros con 6 adicións e 6 borrados
  1. 3 3
      src/Connection/AsyncTcpConnection.php
  2. 3 3
      src/Connection/TcpConnection.php

+ 3 - 3
src/Connection/AsyncTcpConnection.php

@@ -156,7 +156,7 @@ class AsyncTcpConnection extends TcpConnection
                 : $this->_remoteHost . ':' . $this->_remotePort;
         }
 
-        $this->id = $this->_id = self::$_idRecorder++;
+        $this->id = $this->realId = self::$_idRecorder++;
         if (\PHP_INT_MAX === self::$_idRecorder) {
             self::$_idRecorder = 0;
         }
@@ -179,7 +179,7 @@ class AsyncTcpConnection extends TcpConnection
         $this->maxSendBufferSize = self::$defaultMaxSendBufferSize;
         $this->maxPackageSize = self::$defaultMaxPackageSize;
         $this->_contextOption = $context_option;
-        static::$connections[$this->_id] = $this;
+        static::$connections[$this->realId] = $this;
     }
 
     /**
@@ -259,7 +259,7 @@ class AsyncTcpConnection extends TcpConnection
     public function reconnect($after = 0)
     {
         $this->_status = self::STATUS_INITIAL;
-        static::$connections[$this->_id] = $this;
+        static::$connections[$this->realId] = $this;
         if ($this->_reconnectTimer) {
             Timer::del($this->_reconnectTimer);
         }

+ 3 - 3
src/Connection/TcpConnection.php

@@ -285,7 +285,7 @@ class TcpConnection extends ConnectionInterface implements \JsonSerializable
     public function __construct($socket, $remote_address = '')
     {
         ++self::$statistics['connection_count'];
-        $this->id = $this->_id = self::$_idRecorder++;
+        $this->id = $this->realId = self::$_idRecorder++;
         if (self::$_idRecorder === \PHP_INT_MAX) {
             self::$_idRecorder = 0;
         }
@@ -965,9 +965,9 @@ class TcpConnection extends ConnectionInterface implements \JsonSerializable
             $this->onMessage = $this->onClose = $this->onError = $this->onBufferFull = $this->onBufferDrain = null;
             // Remove from worker->connections.
             if ($this->worker) {
-                unset($this->worker->connections[$this->_id]);
+                unset($this->worker->connections[$this->realId]);
             }
-            unset(static::$connections[$this->_id]);
+            unset(static::$connections[$this->realId]);
         }
     }