Fix for limiting AKAs, show parent PID that forked child, other minor fixes
This commit is contained in:
parent
02105b10fb
commit
faeec61aeb
@ -251,7 +251,8 @@ final class Receive extends Item
|
||||
|
||||
if (file_exists($this->file)
|
||||
&& (Storage::disk('local')->lastModified($this->local_path($ao)) === $this->mtime)
|
||||
&& (Storage::disk('local')->size($this->local_path($ao)) === $this->size)) {
|
||||
&& (Storage::disk('local')->size($this->local_path($ao)) === $this->size))
|
||||
{
|
||||
Log::alert(sprintf('%s:- File already exists - skipping [%s]', self::LOGKEY, $this->file));
|
||||
return Protocol::FOP_SKIP;
|
||||
|
||||
|
@ -249,11 +249,15 @@ abstract class Protocol
|
||||
*/
|
||||
public function onConnect(SocketClient $client): ?int
|
||||
{
|
||||
$ppid = getmypid();
|
||||
$pid = pcntl_fork();
|
||||
|
||||
if ($pid === -1)
|
||||
throw new SocketException(SocketException::CANT_ACCEPT,'Could not fork process');
|
||||
|
||||
if ($pid)
|
||||
Log::info(sprintf('%s:- Running connection in pid [%d] (%d)',self::LOGKEY,$pid,$ppid));
|
||||
|
||||
// Parent return ready for next connection
|
||||
return $pid;
|
||||
}
|
||||
@ -295,11 +299,12 @@ abstract class Protocol
|
||||
|
||||
/**
|
||||
* Our addresses to send to the remote
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
protected function our_addresses(): Collection
|
||||
{
|
||||
if ($this->setup->optionGet(Setup::O_HIDEAKA)) {
|
||||
if ($this->setup->optionGet(Setup::O_HIDEAKA,'options_options')) {
|
||||
$addresses = collect();
|
||||
|
||||
foreach (($this->originate ? $this->node->aka_remote_authed : $this->node->aka_remote) as $ao)
|
||||
|
@ -203,23 +203,9 @@ final class Binkp extends BaseProtocol
|
||||
|
||||
// If we are originating, we'll show the remote our address in the same network
|
||||
if ($this->originate) {
|
||||
if ($this->setup->optionGet(Setup::O_HIDEAKA)) {
|
||||
$addresses = collect();
|
||||
$addresses = $this->our_addresses();
|
||||
|
||||
foreach ($this->node->aka_remote_authed as $ao)
|
||||
$addresses = $addresses->merge($this->setup->system->match($ao->zone,Address::NODE_ZC|Address::NODE_RC|Address::NODE_NC|Address::NODE_HC|Address::NODE_ACTIVE|Address::NODE_PVT|Address::NODE_POINT));
|
||||
|
||||
$addresses = $addresses->unique();
|
||||
|
||||
Log::debug(sprintf('%s:- Presenting limited AKAs [%s]',self::LOGKEY,$addresses->pluck('ftn')->join(',')));
|
||||
|
||||
} else {
|
||||
$addresses = $this->setup->system->addresses;
|
||||
|
||||
Log::debug(sprintf('%s:- Presenting ALL our AKAs [%s]',self::LOGKEY,$addresses->pluck('ftn')->join(',')));
|
||||
}
|
||||
|
||||
$this->msgs(self::BPM_ADR,$this->setup->system->addresses->pluck('ftn')->join(' '));
|
||||
$this->msgs(self::BPM_ADR,$addresses->pluck('ftn')->join(' '));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,6 @@ class AddressPoll implements ShouldQueue
|
||||
if (! $this->ao->system->mailer_preferred->count() || ($this->mo && (! $this->ao->system->mailer_preferred->find($this->mo))))
|
||||
throw new \Exception(sprintf('Unable to poll [%s] missing mailer details',$this->ao->ftn));
|
||||
|
||||
|
||||
foreach ($this->ao->system->mailer_preferred as $o) {
|
||||
// If we chose a protocol, skip to find the mailer details for it
|
||||
if ($this->mo && ($o->id !== $this->mo->id))
|
||||
@ -51,7 +50,7 @@ class AddressPoll implements ShouldQueue
|
||||
|
||||
} catch (SocketException $e) {
|
||||
Log::error(sprintf('%s:! Unable to connect to [%s]: %s',self::LOGKEY,$this->ao->ftn,$e->getMessage()));
|
||||
abort(500);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
switch ($o->name) {
|
||||
|
@ -79,7 +79,7 @@ use App\Classes\Protocol\{Binkp,EMSI,DNS};
|
||||
<h3>Site Permissions</h3>
|
||||
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" id="hideaka" name="options[hideaka]" value="{{ old('options.hideaka',$o->hideaka ?: Setup::O_HIDEAKA) }}" @if(old('options.hideaka',$o->optionGet(Setup::O_HIDEAKA,'options_options'))) checked @endif>
|
||||
<input class="form-check-input" type="checkbox" id="hideaka" name="options[hideaka]" value="{{ Setup::O_HIDEAKA }}" @if(old('options.hideaka',$o->optionGet(Setup::O_HIDEAKA,'options_options'))) checked @endif>
|
||||
<label class="form-check-label" for="hideaka">Hide AKA to different Domains</label>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user