Created server:start, turned down BINKP debugging, some Socket tweaks

This commit is contained in:
Deon George
2021-06-16 22:26:08 +10:00
parent 292040cef7
commit f9310566a0
4 changed files with 133 additions and 33 deletions

View File

@@ -276,7 +276,8 @@ final class Binkd extends BaseProtocol
*/
private function binkp_recv(): int
{
Log::debug(sprintf('%s: + Start',__METHOD__));
if ($this->DEBUG)
Log::debug(sprintf('%s: + Start',__METHOD__));
$buf = '';
$blksz = $this->rx_size == -1 ? BinkpMessage::BLK_HDR_SIZE : $this->rx_size;
@@ -288,7 +289,8 @@ final class Binkd extends BaseProtocol
} catch (SocketException $e) {
if ($e->getCode() == 11) {
// @todo We maybe should count these and abort if there are too many?
Log::debug(sprintf('%s: - Socket EAGAIN',__METHOD__));
if ($this->DEBUG)
Log::debug(sprintf('%s: - Socket EAGAIN',__METHOD__));
return 1;
}
@@ -322,7 +324,8 @@ final class Binkd extends BaseProtocol
$this->rx_size = ((ord(substr($buf,0,1))&0x7f) << 8 )+ord(substr($buf,1,1));
$this->rx_ptr = 0;
Log::debug(sprintf('%s: - HEADER, is_msg [%d]',__METHOD__,$this->is_msg));
if ($this->DEBUG)
Log::debug(sprintf('%s: - HEADER, is_msg [%d]',__METHOD__,$this->is_msg));
if ($this->rx_size == 0)
goto ZeroLen;
@@ -332,7 +335,8 @@ final class Binkd extends BaseProtocol
/* Next block */
} else {
ZeroLen:
Log::debug(sprintf('%s: - NEXT BLOCK, is_msg [%d]',__METHOD__,$this->is_msg));
if ($this->DEBUG)
Log::debug(sprintf('%s: - NEXT BLOCK, is_msg [%d]',__METHOD__,$this->is_msg));
if ($this->is_msg) {
$this->mib++;
@@ -346,7 +350,8 @@ final class Binkd extends BaseProtocol
return 1;
}
Log::debug(sprintf('%s: - BUFFER [%d]',__METHOD__,strlen($buf)));
if ($this->DEBUG)
Log::debug(sprintf('%s: - BUFFER [%d]',__METHOD__,strlen($buf)));
$rc = ord(substr($buf,0,1));
@@ -440,7 +445,9 @@ final class Binkd extends BaseProtocol
$rc = 1;
}
Log::debug(sprintf('%s: = End [%d]',__METHOD__,$rc));
if ($this->DEBUG)
Log::debug(sprintf('%s: = End [%d]',__METHOD__,$rc));
return $rc;
}
@@ -449,12 +456,14 @@ final class Binkd extends BaseProtocol
*/
private function binkp_send(): int
{
Log::debug(sprintf('%s: + Start - tx_left [%d]',__METHOD__,$this->tx_left));
if ($this->DEBUG)
Log::debug(sprintf('%s: + Start - tx_left [%d]',__METHOD__,$this->tx_left));
if ($this->tx_left == 0 ) { /* tx buffer is empty */
$this->tx_ptr = $this->tx_left = 0;
Log::debug(sprintf('%s: - Msgs [%d]',__METHOD__,$this->mqueue->count()));
if ($this->DEBUG)
Log::debug(sprintf('%s: - Msgs [%d]',__METHOD__,$this->mqueue->count()));
if ($this->mqueue->count()) { /* there are unsent messages */
while ($msg = $this->mqueue->shift()) {
@@ -522,7 +531,9 @@ final class Binkd extends BaseProtocol
}
}
Log::debug(sprintf('%s: = End [1]',__METHOD__));
if ($this->DEBUG)
Log::debug(sprintf('%s: = End [1]',__METHOD__));
return 1;
}

View File

@@ -418,7 +418,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
Log::notice(sprintf('%s: - Remote Phone Number [%s]',__METHOD__,$this->emsi_dat_parse($str,$x,']')));
/* Baud rate */
$this->client->setSpeed($this->emsi_dat_parse($str,$x,']'));
$this->client->speed = $this->emsi_dat_parse($str,$x,']');
/* Flags */
Log::notice(sprintf('%s: - Remote Flags [%s]',__METHOD__,$this->emsi_dat_parse($str,$x,']')));