Improvements to echomail path handling, ensuring sender and pktsrc are in the path

This commit is contained in:
2023-11-17 12:18:55 +11:00
parent 67747c062a
commit 4a870b6587
2 changed files with 38 additions and 10 deletions

View File

@@ -70,7 +70,7 @@ final class Echomail extends Model implements Packet
static::created(function($model) {
$rogue = collect();
$seenby = NULL;
$path = [];
$path = collect();
// Parse PATH
if ($model->set_path->count())
@@ -104,12 +104,17 @@ final class Echomail extends Model implements Packet
// Our last node in the path is our sender
if (isset($model->set_pkt) && isset($model->set_recvtime)) {
DB::update('UPDATE echomail_path set recv_pkt=?,recv_at=? where address_id=? and echomail_id=?',[
$model->set_pkt,
$model->set_recvtime,
$path->last(),
$model->id,
]);
if ($path->count()) {
DB::update('UPDATE echomail_path set recv_pkt=?,recv_at=? where address_id=? and echomail_id=?',[
$model->set_pkt,
$model->set_recvtime,
$path->last(),
$model->id,
]);
} else {
Log::critical(sprintf('%s:! Wasnt able to set packet details for [%d] to [%s] to [%s], no path information',self::LOGKEY,$model->id,$model->set_pkt,$model->set_recvtime));
}
}
// See if we need to export this message.