Exemple #1
0
 private static function getPack($sign, $conn_id)
 {
     while (1) {
         $data = @self::$conninfo[$conn_id][self::CONNINFO_F_conn]->recv();
         if ($data == false) {
             #throw new \Exception('连接Mysql网络中断');
             self::$conninfo[$conn_id][self::CONNINFO_F_errno] = 2006;
             self::$conninfo[$conn_id][self::CONNINFO_F_erro_msg] = 'Mysql proxy中断(接收失败)';
             return false;
         }
         $r = CLPack::unpack($data);
         if (!$r) {
             self::$conninfo[$conn_id][self::CONNINFO_F_errno] = 2006;
             self::$conninfo[$conn_id][self::CONNINFO_F_erro_msg] = 'Mysql proxy中断(解包失败:' . $data . ')';
             return false;
         }
         if ($r[0] !== $sign) {
             self::$conninfo[$conn_id][self::CONNINFO_F_errno] = 2006;
             self::$conninfo[$conn_id][self::CONNINFO_F_erro_msg] = 'Mysql proxy中断(签名验证失败:"' . $sign . '"!="' . $r[0] . '")';
             return false;
         }
         if (!is_array($r[1])) {
             self::$conninfo[$conn_id][self::CONNINFO_F_errno] = 2006;
             self::$conninfo[$conn_id][self::CONNINFO_F_erro_msg] = '返回非数组结果:' . $data;
             return false;
         }
         return $r[1];
     }
 }
 function getPack($sign)
 {
     while (1) {
         $data = @$this->conn->recv();
         if ($data == false) {
             throw new \Exception('连接Mysql网络中断');
         }
         $r = CLPack::unpack($data);
         if ($r && $r[0] === $sign) {
             return $r[1];
         }
     }
 }
Exemple #3
0
 function getPack($sign)
 {
     while (1) {
         $data = @$this->conn->recv();
         if ($data == false) {
             #throw new \Exception('连接Mysql网络中断');
             $this->last_errno = 2006;
             $this->last_erro_msg = 'Mysql proxy中断';
             return false;
         }
         $r = CLPack::unpack($data);
         if ($r && $r[0] === $sign) {
             return $r[1];
         }
     }
 }