Fix for when msgid address is from an unknown zone
This commit is contained in:
parent
9462e66a1c
commit
f91778b515
@ -426,8 +426,9 @@ 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;
|
||||
|
||||
try {
|
||||
Address::unguard();
|
||||
$ao = Address::firstOrNew([
|
||||
'zone_id' => $msg->fzone->id,
|
||||
@ -438,16 +439,20 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
||||
]);
|
||||
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