Fix casting on compressed attributes when value is NULL, reduce some BINKP debugging messages
This commit is contained in:
parent
9721db185b
commit
c7187dbb0e
@ -10,15 +10,15 @@ class CompressedString implements CastsAttributes
|
|||||||
/**
|
/**
|
||||||
* Cast the given value.
|
* Cast the given value.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Database\Eloquent\Model $model
|
* @param Model $model
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @param array $attributes
|
* @param array $attributes
|
||||||
* @return string
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
public function get($model, string $key, $value, array $attributes): string
|
public function get($model,string $key,$value,array $attributes): ?string
|
||||||
{
|
{
|
||||||
return zstd_uncompress(base64_decode($value));
|
return $value ? zstd_uncompress(base64_decode($value)) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -306,6 +306,7 @@ final class Binkp extends BaseProtocol
|
|||||||
Log::debug(sprintf('%s:+ binkp_recv',self::LOGKEY));
|
Log::debug(sprintf('%s:+ binkp_recv',self::LOGKEY));
|
||||||
|
|
||||||
$blksz = $this->rx_size == -1 ? BinkpMessage::BLK_HDR_SIZE : $this->rx_size;
|
$blksz = $this->rx_size == -1 ? BinkpMessage::BLK_HDR_SIZE : $this->rx_size;
|
||||||
|
if ($this->DEBUG)
|
||||||
Log::debug(sprintf('%s: - binkp_recv blksize [%d] rx_size [%d].',self::LOGKEY,$blksz,$this->rx_size));
|
Log::debug(sprintf('%s: - binkp_recv blksize [%d] rx_size [%d].',self::LOGKEY,$blksz,$this->rx_size));
|
||||||
|
|
||||||
if ($blksz !== 0) {
|
if ($blksz !== 0) {
|
||||||
@ -367,6 +368,7 @@ final class Binkp extends BaseProtocol
|
|||||||
/* Next block */
|
/* Next block */
|
||||||
} else {
|
} else {
|
||||||
ZeroLen:
|
ZeroLen:
|
||||||
|
if ($this->DEBUG)
|
||||||
Log::debug(sprintf('%s: - binkp_recv NEXT BLOCK, is_msg [%d]',self::LOGKEY,$this->is_msg));
|
Log::debug(sprintf('%s: - binkp_recv NEXT BLOCK, is_msg [%d]',self::LOGKEY,$this->is_msg));
|
||||||
|
|
||||||
if ($this->is_msg) {
|
if ($this->is_msg) {
|
||||||
@ -382,6 +384,7 @@ final class Binkp extends BaseProtocol
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->DEBUG)
|
||||||
Log::debug(sprintf('%s: - binkp_recv BUFFER [%d]',self::LOGKEY,strlen($this->rx_buf)));
|
Log::debug(sprintf('%s: - binkp_recv BUFFER [%d]',self::LOGKEY,strlen($this->rx_buf)));
|
||||||
|
|
||||||
$rc = ord(substr($this->rx_buf,0,1));
|
$rc = ord(substr($this->rx_buf,0,1));
|
||||||
@ -477,6 +480,7 @@ final class Binkp extends BaseProtocol
|
|||||||
$rc = 1;
|
$rc = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->DEBUG)
|
||||||
Log::debug(sprintf('%s:= binkp_recv [%d]',self::LOGKEY,$rc));
|
Log::debug(sprintf('%s:= binkp_recv [%d]',self::LOGKEY,$rc));
|
||||||
|
|
||||||
return $rc;
|
return $rc;
|
||||||
@ -487,6 +491,7 @@ final class Binkp extends BaseProtocol
|
|||||||
*/
|
*/
|
||||||
private function binkp_send(): int
|
private function binkp_send(): int
|
||||||
{
|
{
|
||||||
|
if ($this->DEBUG)
|
||||||
Log::debug(sprintf('%s:+ binkp_send - tx_left [%d]',self::LOGKEY,$this->tx_left));
|
Log::debug(sprintf('%s:+ binkp_send - tx_left [%d]',self::LOGKEY,$this->tx_left));
|
||||||
|
|
||||||
if ($this->tx_left == 0 ) { /* tx buffer is empty */
|
if ($this->tx_left == 0 ) { /* tx buffer is empty */
|
||||||
@ -561,6 +566,7 @@ final class Binkp extends BaseProtocol
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->DEBUG)
|
||||||
Log::debug(sprintf('%s:= binkp_send [1]',self::LOGKEY));
|
Log::debug(sprintf('%s:= binkp_send [1]',self::LOGKEY));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -595,6 +601,7 @@ final class Binkp extends BaseProtocol
|
|||||||
*/
|
*/
|
||||||
private function msgs(string $id,string $msg_body): void
|
private function msgs(string $id,string $msg_body): void
|
||||||
{
|
{
|
||||||
|
if ($this->DEBUG)
|
||||||
Log::debug(sprintf('%s:+ msgs [%d:%s]',self::LOGKEY,$id,$msg_body));
|
Log::debug(sprintf('%s:+ msgs [%d:%s]',self::LOGKEY,$id,$msg_body));
|
||||||
|
|
||||||
$this->mqueue->push(new BinkpMessage($id,$msg_body));
|
$this->mqueue->push(new BinkpMessage($id,$msg_body));
|
||||||
|
Loading…
Reference in New Issue
Block a user