Enable duplicates to update seen-by's before being discarded
This commit is contained in:
@@ -59,6 +59,7 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
||||
public Collection $messages; // Messages in the Packet
|
||||
public Collection $errors; // Messages that fail validation
|
||||
private string $name; // Packet name
|
||||
private ?System $system; // System the packet is from
|
||||
public bool $use_redis = TRUE; // Use redis for messages.
|
||||
private int $index; // Our array index
|
||||
|
||||
@@ -116,7 +117,7 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
||||
* @return Packet
|
||||
* @throws InvalidPacketException
|
||||
*/
|
||||
public static function open(File $file,Zone $zone=NULL,bool $use_redis=TRUE): self
|
||||
public static function open(File $file,System $system=NULL,bool $use_redis=TRUE): self
|
||||
{
|
||||
Log::debug(sprintf('%s:+ Opening Packet [%s]',self::LOGKEY,$file));
|
||||
|
||||
@@ -136,7 +137,6 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
||||
throw new InvalidPacketException('Not a type 2 packet: '.$version);
|
||||
|
||||
$o = new self;
|
||||
$o->zone = $zone;
|
||||
$o->use_redis = $use_redis;
|
||||
$o->name = (string)$file;
|
||||
$o->header = unpack(self::unpackheader(self::v2header),$header);
|
||||
@@ -155,6 +155,8 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
||||
else if (! strlen($x))
|
||||
throw new InvalidPacketException('No message in packet: '.bin2hex($x));
|
||||
|
||||
$o->zone = $system?->zones->firstWhere('zone_id',$o->fz);
|
||||
|
||||
// If zone is null, we'll take the zone from the packet
|
||||
if (! $o->zone)
|
||||
$o->zone = Zone::where('zone_id',$o->fz)->where('default',TRUE)->single();
|
||||
|
Reference in New Issue
Block a user