protected function _readHeader()
{
$status = $this->_readByte();
$sessionId = $this->_readInt();
/*
* we must recognize dbOpen and Connect messages
*/
if (!$this instanceof DbOpen && !$this instanceof Connect && $this->_transport->isRequestToken()) {
$token_refresh = $this->_readString();
if (!empty($token_refresh)) {
$this->_transport->setToken($token_refresh);
}
}
if ($status === 1) {
$this->_readByte();
// discard the first byte of the error
$error = $this->_readError();
$this->_dump_streams();
throw $error;
} elseif ($status === 3) {
// server push data for nodes up/down update info,
// needed for failover on cluster
# Push notification, Node cluster changed
#
# BYTE (OChannelBinaryProtocol.PUSH_DATA); # WRITE 3
# INT (Integer.MIN_VALUE); # SESSION ID = 2^-31
# 80: \x50 Request Push 1 byte: Push command id
# STRING $payload
$this->_pushReceived($this->_readByte(), CSV::unserialize($this->_readString()));
$end_flag = $this->_readByte();
# this flag can be set more than once
while ($end_flag == 3) {
$this->_readInt();
# FAKE SESSION ID = 2^-31
$this->_pushReceived($this->_readByte(), CSV::unserialize($this->_readString()));
$end_flag = $this->_readByte();
}
$sessionId = $this->_readInt();
//string termination
}
}