Dont delete archive until all packets processed
This commit is contained in:
parent
4d3d57fdcd
commit
f089f3bcdc
@ -115,18 +115,23 @@ final class Receive extends Item
|
||||
try {
|
||||
$f = new File($this->file);
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
@ -156,15 +161,15 @@ final class Receive extends Item
|
||||
$error = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($po->errors->count() || $error) {
|
||||
Log::info(sprintf('%s: - Not deleting packet [%s], as it has validation errors',self::LOGKEY,$this->file));
|
||||
if ($error) {
|
||||
Log::info(sprintf('%s: - Not deleting packet [%s], as it has validation errors',self::LOGKEY,$this->file));
|
||||
|
||||
// If we want to keep the packet, we could do that logic here
|
||||
} elseif (! config('app.packet_keep')) {
|
||||
Log::debug(sprintf('%s: - Deleting processed packet [%s]',self::LOGKEY,$this->file));
|
||||
unlink($this->file);
|
||||
}
|
||||
// If we want to keep the packet, we could do that logic here
|
||||
} elseif (! config('app.packet_keep')) {
|
||||
Log::debug(sprintf('%s: - Deleting processed packet [%s]',self::LOGKEY,$this->file));
|
||||
unlink($this->file);
|
||||
}
|
||||
|
||||
} catch (InvalidPacketException $e) {
|
||||
|
Loading…
Reference in New Issue
Block a user