Remove processed packets if there were no issues
This commit is contained in:
@@ -56,6 +56,7 @@ class Packet extends FTNBase
|
||||
public File $file; // Packet filename
|
||||
public Collection $messages; // Messages in the Packet
|
||||
private string $name; // Packet name
|
||||
public bool $hasErrors = FALSE; // Packet has validation errors
|
||||
|
||||
public function __construct(Address $o=NULL)
|
||||
{
|
||||
@@ -85,7 +86,6 @@ class Packet extends FTNBase
|
||||
|
||||
// PKT Header
|
||||
$header = fread($f,self::HEADER_LEN);
|
||||
Log::debug(sprintf("%s:\n%s",self::LOGKEY,hex_dump($header)));
|
||||
|
||||
// Could not read header
|
||||
if (strlen($header) != self::HEADER_LEN)
|
||||
@@ -346,6 +346,15 @@ class Packet extends FTNBase
|
||||
*/
|
||||
public function parseMessage(string $message,Domain $domain=NULL): void
|
||||
{
|
||||
$this->messages->push(Message::parseMessage($message,$domain));
|
||||
$msg = Message::parseMessage($message,$domain);
|
||||
|
||||
// If the message is invalid, we'll ignore it
|
||||
if ($msg->errors && $msg->errors->messages()->has('from')) {
|
||||
$this->hasErrors = TRUE;
|
||||
Log::error(sprintf('%s:%s Skipping...',self::LOGKEY,join('|',$msg->errors->messages()->get('from'))));
|
||||
|
||||
} else {
|
||||
$this->messages->push(Message::parseMessage($message,$domain));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user