Change our determination that a packet has been processed before deciding to delete it
This commit is contained in:
parent
dac880b689
commit
d9b575b38f
@ -114,15 +114,14 @@ final class Receive extends Item
|
||||
|
||||
try {
|
||||
$f = new File($this->file);
|
||||
$processed = FALSE;
|
||||
|
||||
$error = FALSE;
|
||||
foreach ($f as $packet) {
|
||||
$po = Packet::process($packet,Arr::get(stream_get_meta_data($packet),'uri'),$f->itemSize(),$this->ao->system);
|
||||
|
||||
// Check the messages are from the uplink
|
||||
if ($this->ao->system->addresses->search(function($item) use ($po) { return $item->id == $po->fftn_o->id; }) === FALSE) {
|
||||
Log::error(sprintf('%s: ! Packet [%s] is not from this link? [%d]',self::LOGKEY,$po->fftn_o->ftn,$this->ao->system_id));
|
||||
$error = TRUE;
|
||||
|
||||
break;
|
||||
}
|
||||
@ -130,7 +129,6 @@ final class Receive extends Item
|
||||
// Check the packet password
|
||||
if ($this->ao->session('pktpass') != $po->password) {
|
||||
Log::error(sprintf('%s: ! Packet from [%s] with password [%s] is invalid.',self::LOGKEY,$this->ao->ftn,$po->password));
|
||||
$error = TRUE;
|
||||
|
||||
// @todo Generate message to system advising invalid password - that message should be sent without a packet password!
|
||||
break;
|
||||
@ -142,7 +140,7 @@ final class Receive extends Item
|
||||
if ($queue = ($po->count() > config('app.queue_msgs')))
|
||||
Log::info(sprintf('%s: - Messages will be sent to the queue for processing',self::LOGKEY));
|
||||
|
||||
$error = FALSE;
|
||||
$count = 0;
|
||||
foreach ($po as $msg) {
|
||||
Log::info(sprintf('%s: - Mail from [%s] to [%s]',self::LOGKEY,$msg->fftn,$msg->tftn));
|
||||
|
||||
@ -158,13 +156,17 @@ final class Receive extends Item
|
||||
|
||||
} catch (Exception $e) {
|
||||
Log::error(sprintf('%s:! Got error dispatching message [%s] (%d:%s-%s).',self::LOGKEY,$msg->msgid,$e->getLine(),$e->getFile(),$e->getMessage()));
|
||||
$error = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
Log::info(sprintf('%s: - Not deleting packet [%s], as it has validation errors',self::LOGKEY,$this->file));
|
||||
$count++;
|
||||
}
|
||||
|
||||
if ($count === $po->count())
|
||||
$processed = TRUE;
|
||||
}
|
||||
|
||||
if (! $processed) {
|
||||
Log::alert(sprintf('%s: - Not deleting packet [%s], it doesnt seem to be processed?',self::LOGKEY,$this->file));
|
||||
|
||||
// If we want to keep the packet, we could do that logic here
|
||||
} elseif (! config('app.packet_keep')) {
|
||||
|
Loading…
Reference in New Issue
Block a user