A piece of code from swoole rpc

< H2 > File location < / H2 >

libs/Swoole/Client/RPC.php

 protected function request($send, $retObj)
    {
        $retObj->send = $send;
        $this->beforeRequest($retObj);

        $retObj->index = $this->requestIndexPP;
        connect_to_server:
        if ($this->connectToServer($retObj) === false)
        {
            $retObj->code = RPC_Result::ERR_CONNECT;
            return false;
        }
        //
        $retObj->requestId = self::getRequestId();
        //
        $encodeType = $this->encode_type;
        if ($this->encode_gzip)
        {
            $encodeType |= RPCServer::DECODE_GZIP;
        }
        //
        if ($retObj->socket->send(RPCServer::encode($retObj->send, $encodeType, 0, $retObj->requestId)) === false)
        {
            $this->closeConnection($retObj->server_host, $retObj->server_port);
            //
            if ($this->haveSwoole and $retObj->socket->errCode == 104)
            {
                goto connect_to_server;
            }
            $retObj->code = RPC_Result::ERR_SEND;
            unset($retObj->socket);
            return false;
        }
        $retObj->code = RPC_Result::ERR_RECV;
        //wait_list
        $this->waitList[$retObj->requestId] = $retObj;
        return true;
    }
< H2 > question: < / H2 >

$encodeType | = RPCServer::DECODE_GZIP;

this | = what is the operation?

May.31,2022

| = is a syntax of php

$encodeType | = RPCServer::DECODE_GZIP; = $encodeType = $encodeType | RPCServer::DECODE_GZIP;

Menu