Enable processing messages coming from a domain with multiple zones
This commit is contained in:
parent
c1ab14f2e6
commit
109beb4f4f
@ -222,7 +222,7 @@ class Message extends FTNBase
|
|||||||
|
|
||||||
case 'fdomain':
|
case 'fdomain':
|
||||||
// We'll use the zone's domain if this method class was called with a zone
|
// We'll use the zone's domain if this method class was called with a zone
|
||||||
if ($this->zone && ($this->zone->domain->name == Arr::get($this->src,'d')))
|
if ($this->zone && (($this->zone->domain->name == Arr::get($this->src,'d')) || ! Arr::get($this->src,'d')))
|
||||||
return $this->zone->domain;
|
return $this->zone->domain;
|
||||||
|
|
||||||
// If we get the domain from the packet, we'll find it
|
// If we get the domain from the packet, we'll find it
|
||||||
@ -234,7 +234,7 @@ class Message extends FTNBase
|
|||||||
|
|
||||||
case 'tdomain':
|
case 'tdomain':
|
||||||
// We'll use the zone's domain if this method class was called with a zone
|
// We'll use the zone's domain if this method class was called with a zone
|
||||||
if ($this->zone && ($this->zone->domain->name == Arr::get($this->dst,'d')))
|
if ($this->zone && (($this->zone->domain->name == Arr::get($this->dst,'d')) || ! Arr::get($this->dst,'d')))
|
||||||
return $this->zone->domain;
|
return $this->zone->domain;
|
||||||
|
|
||||||
// If we get the domain from the packet, we'll find it
|
// If we get the domain from the packet, we'll find it
|
||||||
@ -250,7 +250,6 @@ class Message extends FTNBase
|
|||||||
if ($this->zone && ($this->fz == $this->zone->zone_id))
|
if ($this->zone && ($this->fz == $this->zone->zone_id))
|
||||||
return $this->zone;
|
return $this->zone;
|
||||||
|
|
||||||
// If we have a domain, we'll use the zone from the domain
|
|
||||||
if ($this->fdomain) {
|
if ($this->fdomain) {
|
||||||
if (($x=$this->fdomain->zones->search(function($item) { return $item->zone_id == $this->fz; })) !== FALSE)
|
if (($x=$this->fdomain->zones->search(function($item) { return $item->zone_id == $this->fz; })) !== FALSE)
|
||||||
return $this->fdomain->zones->get($x);
|
return $this->fdomain->zones->get($x);
|
||||||
@ -266,7 +265,6 @@ class Message extends FTNBase
|
|||||||
if ($this->zone && ($this->tz == $this->zone->zone_id))
|
if ($this->zone && ($this->tz == $this->zone->zone_id))
|
||||||
return $this->zone;
|
return $this->zone;
|
||||||
|
|
||||||
// If we have a domain, we'll use the zone from the domain
|
|
||||||
if ($this->tdomain) {
|
if ($this->tdomain) {
|
||||||
if (($x=$this->tdomain->zones->search(function($item) { return $item->zone_id == $this->tz; })) !== FALSE)
|
if (($x=$this->tdomain->zones->search(function($item) { return $item->zone_id == $this->tz; })) !== FALSE)
|
||||||
return $this->tdomain->zones->get($x);
|
return $this->tdomain->zones->get($x);
|
||||||
@ -290,10 +288,11 @@ class Message extends FTNBase
|
|||||||
case 'tftn_o':
|
case 'tftn_o':
|
||||||
return parent::__get($key);
|
return parent::__get($key);
|
||||||
|
|
||||||
|
// For 5D we need to include the domain
|
||||||
case 'fboss':
|
case 'fboss':
|
||||||
return sprintf('%d:%d/%d',$this->fz,$this->fn,$this->ff);
|
return sprintf('%d:%d/%d',$this->fz,$this->fn,$this->ff).(($x=$this->fdomain) ? '@'.$x->name : '');
|
||||||
case 'tboss':
|
case 'tboss':
|
||||||
return sprintf('%d:%d/%d',$this->tz,$this->tn,$this->tf);
|
return sprintf('%d:%d/%d',$this->tz,$this->tn,$this->tf).(($x=$this->tdomain) ? '@'.$x->name : '');
|
||||||
case 'fboss_o':
|
case 'fboss_o':
|
||||||
return Address::findFTN($this->fboss);
|
return Address::findFTN($this->fboss);
|
||||||
case 'tboss_o':
|
case 'tboss_o':
|
||||||
|
@ -443,8 +443,6 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
|||||||
|
|
||||||
// If the from address doenst exist, we'll create a new entry
|
// If the from address doenst exist, we'll create a new entry
|
||||||
if ($msg->errors->messages()->has('to') && $msg->tzone) {
|
if ($msg->errors->messages()->has('to') && $msg->tzone) {
|
||||||
$e = NULL;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// @todo Need to work out the correct region for the host_id
|
// @todo Need to work out the correct region for the host_id
|
||||||
Address::unguard();
|
Address::unguard();
|
||||||
@ -454,21 +452,16 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
|||||||
'host_id' => $msg->tn,
|
'host_id' => $msg->tn,
|
||||||
'node_id' => $msg->tf,
|
'node_id' => $msg->tf,
|
||||||
'point_id' => $msg->tp,
|
'point_id' => $msg->tp,
|
||||||
|
'active' => TRUE,
|
||||||
]);
|
]);
|
||||||
Address::reguard();
|
Address::reguard();
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error(sprintf('%s:! Error finding/creating TO address [%s] for message',self::LOGKEY,$msg->tboss),['error'=>$e->getMessage()]);
|
Log::error(sprintf('%s:! Error finding/creating TO address [%s] for message',self::LOGKEY,$msg->tboss),['error'=>$e->getMessage()]);
|
||||||
}
|
|
||||||
|
|
||||||
// This shouldnt happen
|
|
||||||
if ($e || $ao->exists) {
|
|
||||||
Log::error(sprintf('%s:! Unexpected error attempting to create TO address [%s]',self::LOGKEY,$msg->tboss));
|
|
||||||
$this->errors->push($msg);
|
$this->errors->push($msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ao->active = TRUE;
|
|
||||||
$ao->role = Address::NODE_UNKNOWN;
|
$ao->role = Address::NODE_UNKNOWN;
|
||||||
|
|
||||||
System::unguard();
|
System::unguard();
|
||||||
@ -486,8 +479,6 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($msg->errors->messages()->has('from') && $msg->tzone) {
|
if ($msg->errors->messages()->has('from') && $msg->tzone) {
|
||||||
$e = NULL;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// @todo Need to work out the correct region for the host_id
|
// @todo Need to work out the correct region for the host_id
|
||||||
Address::unguard();
|
Address::unguard();
|
||||||
@ -497,21 +488,16 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
|||||||
'host_id' => $msg->fn,
|
'host_id' => $msg->fn,
|
||||||
'node_id' => $msg->ff,
|
'node_id' => $msg->ff,
|
||||||
'point_id' => $msg->fp,
|
'point_id' => $msg->fp,
|
||||||
|
'active'=> TRUE,
|
||||||
]);
|
]);
|
||||||
Address::reguard();
|
Address::reguard();
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error(sprintf('%s:! Error finding/creating FROM address [%s] for message',self::LOGKEY,$msg->fboss),['error'=>$e->getMessage()]);
|
Log::error(sprintf('%s:! Error finding/creating FROM address [%s] for message',self::LOGKEY,$msg->fboss),['error'=>$e->getMessage()]);
|
||||||
}
|
|
||||||
|
|
||||||
// This shouldnt happen
|
|
||||||
if ($e || $ao->exists) {
|
|
||||||
Log::error(sprintf('%s:! Unexpected error attempting to create FROM address [%s]',self::LOGKEY,$msg->fboss));
|
|
||||||
$this->errors->push($msg);
|
$this->errors->push($msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ao->active = TRUE;
|
|
||||||
$ao->role = Address::NODE_UNKNOWN;
|
$ao->role = Address::NODE_UNKNOWN;
|
||||||
|
|
||||||
System::unguard();
|
System::unguard();
|
||||||
|
Loading…
Reference in New Issue
Block a user