Enabled configuration of EMSI tunables in setup
This commit is contained in:
parent
c3d4c1fc31
commit
0f7a42c503
@ -6,6 +6,7 @@ use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\File\{Receive,Send};
|
||||
use App\Classes\Protocol\EMSI;
|
||||
use App\Classes\Sock\SocketClient;
|
||||
use App\Classes\Sock\SocketException;
|
||||
use App\Models\{Address,Setup,System,SystemLog};
|
||||
@ -402,7 +403,7 @@ abstract class Protocol
|
||||
|
||||
// @todo These flags determine when we connect to the remote.
|
||||
// If the remote indicated that they dont support file requests (NRQ) or temporarily hold them (HRQ)
|
||||
if (($this->node->optionGet(self::O_NRQ) && (! $this->setup->ignore_nrq)) || $this->node->optionGet(self::O_HRQ))
|
||||
if (($this->node->optionGet(self::O_NRQ) && (! $this->setup->optionGet(EMSI::F_IGNORE_NRQ,'emsi_options'))) || $this->node->optionGet(self::O_HRQ))
|
||||
$rc |= self::S_HOLDR;
|
||||
|
||||
if ($this->optionGet(self::O_HXT))
|
||||
|
@ -39,6 +39,13 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
|
||||
private const NL = "\n";
|
||||
private const DEL = "\x08";
|
||||
|
||||
/* FEATURES */
|
||||
|
||||
/** Ignore NRQ */
|
||||
public const F_IGNORE_NRQ = 1<<0;
|
||||
/** Send an immediate EMSI_INQ on connect */
|
||||
public const F_DO_PREVENT = 1<<1;
|
||||
|
||||
private const EMSI_BUF = 8192;
|
||||
private const TMP_LEN = 1024;
|
||||
|
||||
@ -825,6 +832,9 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
|
||||
if ($this->originate) {
|
||||
$gotreq = 0;
|
||||
|
||||
if ($this->setup->optionGet(EMSI::F_DO_PREVENT,'emsi_options'))
|
||||
$this->capSet(EMSI::F_DO_PREVENT,self::O_YES);
|
||||
|
||||
// Send a character to get a response from the remote
|
||||
$t1 = $this->client->timer_set(self::EMSI_HSTIMEOUT);
|
||||
do {
|
||||
@ -848,8 +858,8 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
|
||||
return self::TIMEOUT;
|
||||
|
||||
if ($this->client->timer_expired($t2)) {
|
||||
if ($this->setup->do_prevent && $tries === 0) {
|
||||
$this->setup->do_prevent = 0;
|
||||
if ($this->capGet(EMSI::F_DO_PREVENT,self::O_YES) && $tries === 0) {
|
||||
$this->capSet(EMSI::F_DO_PREVENT,self::O_NO);
|
||||
|
||||
$this->client->buffer_add(self::EMSI_INQ.self::CR);
|
||||
$this->client->buffer_flush(5);
|
||||
|
@ -37,23 +37,11 @@ class Setup extends Model
|
||||
|
||||
public const MAX_MSGS_PKT = 50;
|
||||
|
||||
// Our non model attributes and values
|
||||
private array $internal = [];
|
||||
|
||||
protected $casts = [
|
||||
'options' => 'array',
|
||||
'servers' => 'array',
|
||||
];
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
|
||||
/* EMSI SETTINGS */
|
||||
$this->do_prevent = 1; /* EMSI - send an immediate EMSI_INQ on connect */
|
||||
$this->ignore_nrq = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
@ -83,10 +71,6 @@ class Setup extends Model
|
||||
case 'emsi_options':
|
||||
return Arr::get($this->servers,str_replace('_','.',$key));
|
||||
|
||||
case 'ignore_nrq':
|
||||
case 'do_prevent':
|
||||
return $this->internal[$key] ?? FALSE;
|
||||
|
||||
case 'msgs_pkt':
|
||||
return Arr::get($this->options,$key,self::MAX_MSGS_PKT);
|
||||
|
||||
@ -115,11 +99,6 @@ class Setup extends Model
|
||||
case 'emsi_options':
|
||||
return Arr::set($this->servers,str_replace('_','.',$key),$value);
|
||||
|
||||
case 'ignore_nrq':
|
||||
case 'do_prevent':
|
||||
$this->internal[$key] = $value;
|
||||
break;
|
||||
|
||||
default:
|
||||
parent::__set($key,$value);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!-- $o = Setup::class -->
|
||||
@php
|
||||
use App\Models\Setup;
|
||||
use App\Classes\Protocol\Binkp;
|
||||
use App\Classes\Protocol\{Binkp,EMSI,DNS};
|
||||
@endphp
|
||||
|
||||
@extends('layouts.app')
|
||||
@ -212,6 +212,17 @@ use App\Classes\Protocol\Binkp;
|
||||
<input class="form-check-input" type="checkbox" id="startemsi" name="emsi_active" value="1" @if(old('emsi_active',$o->emsi_active)) checked @endif>
|
||||
<label class="form-check-label" for="startemsi">Listen for EMSI connections</label>
|
||||
</div>
|
||||
|
||||
<div class="mt-1 form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" id="emsi_nrq" name="emsi[nrq]" value="{{ EMSI::F_IGNORE_NRQ }}" @if(old('emsi.nrq',$o->optionGet(EMSI::F_IGNORE_NRQ,'emsi_options'))) checked @endif>
|
||||
<label class="form-check-label" for="emsi_nrq">Ignore NRQ</label>
|
||||
</div>
|
||||
|
||||
<div class="mt-1 form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" id="emsi_doprevent" name="emsi[doprevent]" value="{{ EMSI::F_DO_PREVENT }}" @if(old('emsi.doprevent',$o->optionGet(EMSI::F_DO_PREVENT,'emsi_options'))) checked @endif>
|
||||
<label class="form-check-label" for="emsi_doprevent">Send an EMSI_INQ on connect</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user