Optimise the setting of our configuration via Setup::class, optimise the calculation of our_addresses()

This commit is contained in:
2024-11-02 23:30:42 +11:00
parent 1b228a58c9
commit 3b7ce4b9ce
9 changed files with 72 additions and 66 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Classes;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Log;
use App\Classes\File\{Receive,Send};
@@ -107,7 +108,7 @@ abstract class Protocol
public const TCP_SPEED = 115200;
protected SocketClient $client; /* Our socket details */
protected ?Setup $setup; /* Our setup */
protected Setup $setup; /* Our setup */
protected Node $node; /* The node we are communicating with */
/** The list of files we are sending */
protected Send $send;
@@ -134,12 +135,9 @@ abstract class Protocol
abstract protected function protocol_session(bool $force_queue=FALSE): int;
public function __construct(Setup $o=NULL)
public function __construct()
{
if ($o && ! $o->system->akas->count())
throw new \Exception('We dont have any ACTIVE FTN addresses assigned');
$this->setup = $o;
$this->setup = Config::get('setup');
}
/**
@@ -318,7 +316,7 @@ abstract class Protocol
Log::debug(sprintf('%s:- Presenting limited AKAs [%s]',self::LOGKEY,$addresses->pluck('ftn')->join(',')));
} else {
$addresses = $this->setup->system->akas;
$addresses = our_address();
Log::debug(sprintf('%s:- Presenting ALL our AKAs [%s]',self::LOGKEY,$addresses->pluck('ftn')->join(',')));
}