From dd04872c1dd9885fb868689e57d9327146d228cc Mon Sep 17 00:00:00 2001 From: Deon George Date: Fri, 31 Jan 2025 16:33:43 +1100 Subject: [PATCH] IAC binary --- app/Classes/Protocol/EMSI.php | 2 +- app/Classes/Sock/SocketClient.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Classes/Protocol/EMSI.php b/app/Classes/Protocol/EMSI.php index 336c16e..9028138 100644 --- a/app/Classes/Protocol/EMSI.php +++ b/app/Classes/Protocol/EMSI.php @@ -1005,7 +1005,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface break; default: - Log::debug(sprintf('%s: - IAC [%02x]',self::LOGKEY,ord($iac))); + Log::debug(sprintf('%s: - IAC Unhandled [%02x]',self::LOGKEY,ord($iac)),['iac'=>$iac,'iaccmd'=>$iaccmd,'ch'=>ord($iac)]); $ch = ord($iac); $iac = NULL; diff --git a/app/Classes/Sock/SocketClient.php b/app/Classes/Sock/SocketClient.php index 5071708..421ccff 100644 --- a/app/Classes/Sock/SocketClient.php +++ b/app/Classes/Sock/SocketClient.php @@ -492,14 +492,14 @@ final class SocketClient { } } - $this->rx_buf .= $buf; - if ($flags === MSG_PEEK) { - Log::debug(sprintf('%s:- Returning [%d] chars as a result of a PEEK operation, buffer would have [%d], but still has [%d]',self::LOGKEY,$len,strlen($this->rx_buf.$buf),strlen($this->rx_buf)),['rx_buf'=>hex_dump($this->rx_buf),'buf'=>$buf]); + Log::debug(sprintf('%s:- Returning [%d] chars as a result of a PEEK operation, buffer would have [%d], but still has [%d]',self::LOGKEY,$len,strlen($this->rx_buf.$buf),strlen($this->rx_buf)),['rx_buf'=>hex_dump($this->rx_buf),'buf'=>hex_dump($buf)]); return substr($this->rx_buf.$buf,0,$len); } + $this->rx_buf .= $buf; + if (self::DEBUG) Log::debug(sprintf('%s:- Added [%d] chars to the RX buffer',self::LOGKEY,strlen($buf)),['rx_buf'=>hex_dump($this->rx_buf)]);