Pārlūkot izejas kodu

Update TcpConnection.php

mouyong 3 gadi atpakaļ
vecāks
revīzija
2294337a56
1 mainītis faili ar 2 papildinājumiem un 29 dzēšanām
  1. 2 29
      src/Connection/TcpConnection.php

+ 2 - 29
src/Connection/TcpConnection.php

@@ -25,6 +25,8 @@ use Serializable;
  */
 class TcpConnection extends ConnectionInterface implements JsonSerializable, Serializable
 {
+    use Traits\SerializeTrait;
+
     /**
      * Read buffer size.
      *
@@ -974,33 +976,4 @@ class TcpConnection extends ConnectionInterface implements JsonSerializable, Ser
             }
         }
     }
-
-    public function jsonSerialize()
-    {
-        return [
-            'transport' => $this->transport,
-            'id' => $this->id,
-            'status' => $this->getStatus(),
-            'getRemoteIp' => $this->getRemoteIp(),
-            'remotePort' => $this->getRemotePort(),
-            'getRemoteAddress' => $this->getRemoteAddress(),
-            'getLocalIp' => $this->getLocalIp(),
-            'getLocalPort' => $this->getLocalPort(),
-            'getLocalAddress' => $this->getLocalAddress(),
-            'isIpV4' => $this->isIpV4(),
-            'isIpV6' => $this->isIpV6(),
-        ];
-    }
-
-    public function serialize()
-    {
-        return serialize($this->jsonSerialize());
-    }
-
-    public function unserialize(string $data)
-    {
-        // 仅仅打印信息,不做操作,进程数据不可进行改变
-        var_export(sprintf("unserialize %s \n", get_class($this)));
-        var_export(unserialize($data));
-    }
 }