Complete of logging received and sent packet names, and display them in the web ui for each node

This commit is contained in:
2023-07-15 22:10:05 +10:00
parent 61ab0614b6
commit a3302b4012
14 changed files with 257 additions and 121 deletions

View File

@@ -85,11 +85,13 @@ final class Netmail extends Model implements Packet
$ppoid = $po[0]->id;
}
// Our last node in the path is our sender
if (isset($model->set_pkt) && isset($model->set_sender)) {
DB::update('UPDATE netmail_path set recv_pkt=?,recv_id=? where address_id=?',[
DB::update('UPDATE netmail_path set recv_pkt=?,recv_id=? where address_id=? and netmail_id=?',[
$model->set_pkt,
$model->set_sender->id,
Arr::get($model->set_path->last(),'node')->id,
$model->id,
]);
}
}
@@ -130,7 +132,7 @@ final class Netmail extends Model implements Packet
*/
public function packet(Address $ao): Message
{
Log::debug(sprintf('%s:Bundling [%s]',self::LOGKEY,$this->id));
Log::debug(sprintf('%s:+ Bundling [%s]',self::LOGKEY,$this->id));
// @todo Dont bundle mail to nodes that have been disabled, or addresses that have been deleted
$o = new Message;
@@ -169,6 +171,7 @@ final class Netmail extends Model implements Packet
// VIA kludge
$sysaddress = Setup::findOrFail(config('app.id'))->system->match($this->fftn->zone)->first();
$via = $this->via ?: collect();
// Add our address to the VIA line
$via->push(
sprintf('%s @%s.UTC %s %d.%d/%s %s',
$sysaddress->ftn3d,
@@ -185,7 +188,7 @@ final class Netmail extends Model implements Packet
$o->packed = TRUE;
} catch (\Exception $e) {
Log::error(sprintf('%s:Error converting netmail [%s] to a message (%d:%s)',self::LOGKEY,$this->id,$e->getLine(),$e->getMessage()));
Log::error(sprintf('%s:! Error converting netmail [%s] to a message (%d:%s)',self::LOGKEY,$this->id,$e->getLine(),$e->getMessage()));
dump($this);
}