Dont process incomplete files
This commit is contained in:
parent
8996b3d09b
commit
393600f96f
@ -32,6 +32,7 @@ class Item
|
|||||||
|
|
||||||
public bool $sent = FALSE;
|
public bool $sent = FALSE;
|
||||||
public bool $received = FALSE;
|
public bool $received = FALSE;
|
||||||
|
public bool $incomplete = FALSE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws FileNotFoundException
|
* @throws FileNotFoundException
|
||||||
|
@ -84,8 +84,10 @@ final class Receive extends Item
|
|||||||
if (! $this->f)
|
if (! $this->f)
|
||||||
throw new Exception('No file to close');
|
throw new Exception('No file to close');
|
||||||
|
|
||||||
if ($this->file_pos != $this->receiving->file_size)
|
if ($this->file_pos != $this->receiving->file_size) {
|
||||||
Log::warning(sprintf('%s: - Closing [%s], but missing [%d] bytes',__METHOD__,$this->receiving->file_name,$this->receiving->file_size-$this->file_pos));
|
Log::warning(sprintf('%s: - Closing [%s], but missing [%d] bytes',__METHOD__,$this->receiving->file_name,$this->receiving->file_size-$this->file_pos));
|
||||||
|
$this->receiving->incomplete = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
$this->receiving->received = TRUE;
|
$this->receiving->received = TRUE;
|
||||||
|
|
||||||
@ -96,7 +98,10 @@ final class Receive extends Item
|
|||||||
$this->file_pos = 0;
|
$this->file_pos = 0;
|
||||||
$this->f = NULL;
|
$this->f = NULL;
|
||||||
|
|
||||||
|
// If the packet has been received but not the right size, dont process it any more.
|
||||||
|
|
||||||
// If we received a packet, we'll dispatch a job to process it
|
// If we received a packet, we'll dispatch a job to process it
|
||||||
|
if (! $this->receiving->incomplete)
|
||||||
switch ($this->receiving->file_type) {
|
switch ($this->receiving->file_type) {
|
||||||
case self::IS_PKT:
|
case self::IS_PKT:
|
||||||
Log::info(sprintf('%s: - Processing mail packet [%s]',__METHOD__,$this->file));
|
Log::info(sprintf('%s: - Processing mail packet [%s]',__METHOD__,$this->file));
|
||||||
|
Loading…
Reference in New Issue
Block a user