When originating a session, send anything received via the queue

This commit is contained in:
2023-11-22 21:04:58 +11:00
parent 7847728e52
commit e5de4970d1
6 changed files with 27 additions and 17 deletions

View File

@@ -34,6 +34,7 @@ class Receive extends Base
private ?string $comp;
/** @var string|null The compressed data received */
private ?string $comp_data;
private $queue = FALSE;
public function __construct()
{
@@ -125,8 +126,8 @@ class Receive extends Base
case self::IS_PKT:
try {
// If packet is greater than a size, lets queue it
if ($this->receiving->size > config('fido.queue_size',0)) {
Log::info(sprintf('%s:- Packet [%s] will be sent to the queue for processing because its [%d] size',self::LOGKEY,$this->receiving->full_name,$this->receiving->size));
if ($this->queue || ($this->receiving->size > config('fido.queue_size',0))) {
Log::info(sprintf('%s:- Packet [%s] will be sent to the queue for processing because its [%d] size, or queue forced',self::LOGKEY,$this->receiving->full_name,$this->receiving->size));
PacketProcess::dispatch($this->receiving,$this->ao,$rcvd_time);
} else
@@ -157,11 +158,12 @@ class Receive extends Base
/**
* Add a new file to receive
*
* @param array $file
* @param Address $ao
* @param array $file The name of the receiving file
* @param Address $ao Sender sending a file to us
* @param bool $queue Force sending received items to the queue
* @throws \Exception
*/
public function new(array $file,Address $ao): void
public function new(array $file,Address $ao,$queue=FALSE): void
{
Log::debug(sprintf('%s:+ Receiving new file [%s]',self::LOGKEY,join('|',$file)));
@@ -169,6 +171,7 @@ class Receive extends Base
throw new \Exception('Can only have 1 file receiving at a time');
$this->ao = $ao;
$this->queue = $queue;
$this->list->push(new Item($ao,Arr::get($file,'name'),(int)Arr::get($file,'mtime'),(int)Arr::get($file,'size')));
$this->index = $this->list->count()-1;