Fix for when msgid address is from an unknown zone
This commit is contained in:
parent
9462e66a1c
commit
f91778b515
@ -426,28 +426,33 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
||||
if ($msg->errors) {
|
||||
// If the from address doenst exist, we'll create a new entry
|
||||
if ($msg->errors->messages()->has('from')) {
|
||||
Log::alert(sprintf('%s: - From FTN is not defined, creating new entry for [%s]',self::LOGKEY,$msg->fboss));
|
||||
$e = NULL;
|
||||
|
||||
Address::unguard();
|
||||
$ao = Address::firstOrNew([
|
||||
'zone_id' => $msg->fzone->id,
|
||||
'region_id' => 0,
|
||||
'host_id' => $msg->fn,
|
||||
'node_id' => $msg->ff,
|
||||
'point_id' => $msg->fp,
|
||||
]);
|
||||
Address::reguard();
|
||||
try {
|
||||
Address::unguard();
|
||||
$ao = Address::firstOrNew([
|
||||
'zone_id' => $msg->fzone->id,
|
||||
'region_id' => 0,
|
||||
'host_id' => $msg->fn,
|
||||
'node_id' => $msg->ff,
|
||||
'point_id' => $msg->fp,
|
||||
]);
|
||||
Address::reguard();
|
||||
|
||||
$ao->active = TRUE;
|
||||
$ao->role = DomainController::NODE_UNKNOWN;
|
||||
} catch (\Exception $e) {
|
||||
Log::error(sprintf('%s:! Error finding/creating address [%s] for message',self::LOGKEY,$msg->fboss));
|
||||
}
|
||||
|
||||
// This shouldnt happen
|
||||
if ($ao->exists) {
|
||||
Log::error(sprintf('%s: - Attempting to create address [%s], but it exists?',self::LOGKEY,$msg->fboss));
|
||||
if ($e || $ao->exists) {
|
||||
Log::error(sprintf('%s:! Attempting to create address [%s], but it exists?',self::LOGKEY,$msg->fboss));
|
||||
$this->errors->push($msg);
|
||||
return;
|
||||
}
|
||||
|
||||
$ao->active = TRUE;
|
||||
$ao->role = DomainController::NODE_UNKNOWN;
|
||||
|
||||
System::unguard();
|
||||
$so = System::firstOrCreate([
|
||||
'name' => 'Discovered System',
|
||||
@ -459,6 +464,8 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
||||
|
||||
$so->addresses()->save($ao);
|
||||
|
||||
Log::alert(sprintf('%s: - From FTN is not defined, creating new entry for [%s] (%d)',self::LOGKEY,$msg->fboss,$ao->id));
|
||||
|
||||
} elseif($msg->errors->messages()->has('user_from') || $msg->errors->messages()->has('user_to')) {
|
||||
Log::error(sprintf('%s:! Skipping message [%s] due to errors (%s)...',self::LOGKEY,$msg->msgid,join(',',$msg->errors->messages()->keys())));
|
||||
$this->errors->push($msg);
|
||||
|
Loading…
Reference in New Issue
Block a user