Fix seenby/path addresses, fix when eom signature is split over the readbuf

This commit is contained in:
Deon George
2021-08-26 22:01:16 +10:00
parent 0834288a28
commit 403dde0d35
2 changed files with 47 additions and 11 deletions

View File

@@ -208,7 +208,22 @@ class Message extends FTNBase
{
$o = new self($domain);
$o->header = unpack(self::unpackheader(self::header),substr($msg,0,self::HEADER_LEN));
try {
$o->header = unpack(self::unpackheader(self::header),substr($msg,0,self::HEADER_LEN));
} catch (\Exception $e) {
Log::error(sprintf('%s:! Error bad packet header',self::LOGKEY));
$validator = Validator::make([
'header' => substr($msg,0,self::HEADER_LEN),
],[
'header' => [function ($attribute,$value,$fail) use ($e) { return $fail($e->getMessage()); }]
]);
if ($validator->fails())
$o->errors = $validator;
return $o;
}
$ptr = 0;
// To User
@@ -577,7 +592,7 @@ class Message extends FTNBase
if ($aos->has($ftn))
$ao = $aos->get($ftn);
else
$aos->put($ftn,$ao=(bool)Address::findFTN($ftn));
$aos->put($ftn,($ao=(Address::findFTN($ftn))?->id));
if (! $ao) {
Log::alert(sprintf('%s:! Undefined Node [%s] in %s.',self::LOGKEY,$ftn,$type));