Fix processing packets when we loop without reading

This commit is contained in:
Deon George 2022-11-15 22:01:05 +11:00
parent 3ffb1c1fd6
commit 4e66990826
3 changed files with 6 additions and 5 deletions

View File

@ -893,6 +893,7 @@ class Message extends FTNBase
} elseif ($this->zone) {
$this->src = Address::parseFTN(sprintf('%d:%d/%d.%d@%s',$this->zone->zone_id,$this->fn,$this->ff,$this->fp,$this->zone->domain->name));
}
// Parse SEEN-BY
if ($this->seenby->count())
$this->seenaddress = $this->parseAddresses('seenby',$this->seenby,$this->rogue_seenby);

View File

@ -175,7 +175,8 @@ class Packet extends FTNBase implements \Iterator, \Countable
$last = '';
while ($buf_ptr || (! feof($f) && ($readbuf=fread($f,self::BLOCKSIZE)))) {
$read_ptr += strlen($readbuf);
if (! $buf_ptr)
$read_ptr += strlen($readbuf); // Could use ftell()
if (strlen($message) < self::PACKED_MSG_HEADER_LEN) {
$addchars = self::PACKED_MSG_HEADER_LEN-strlen($message);
@ -207,7 +208,7 @@ class Packet extends FTNBase implements \Iterator, \Countable
}
if (($end=strpos($readbuf,"\x00\x02\x00",$buf_ptr)) === FALSE) {
// In case our packet break is at the end of the buffer
// Just in case our packet break is at the end of the buffer
$last = substr($readbuf,-2);
if ((str_contains($last,"\x00")) && ($size-$read_ptr > 2)) {

View File

@ -4,13 +4,12 @@ namespace App\Classes\FTN;
use Carbon\Carbon;
use Illuminate\Contracts\Filesystem\FileNotFoundException;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use League\Flysystem\UnableToWriteFile;
use App\Classes\FTN as FTNBase;
use App\Models\{Address, File, Filearea, Setup};
use App\Models\{Address,File,Filearea};
use App\Traits\EncodeUTF8;
/**
@ -22,7 +21,7 @@ class Tic extends FTNBase
{
use EncodeUTF8;
private const LOGKEY = 'FM-';
private const LOGKEY = 'FT-';
private const cast_utf8 = [
];