From 98c9b880d4a32106f6a6577c6d4792ef6b00a9c8 Mon Sep 17 00:00:00 2001 From: Deon George Date: Thu, 20 Jan 2022 22:47:44 +1100 Subject: [PATCH] Some debugging to track packet names created for sending --- app/Classes/FTN/Packet.php | 6 ++++-- app/Classes/File/Send.php | 1 + app/Classes/Protocol/Binkp.php | 6 +++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/Classes/FTN/Packet.php b/app/Classes/FTN/Packet.php index 47706e6..96442bd 100644 --- a/app/Classes/FTN/Packet.php +++ b/app/Classes/FTN/Packet.php @@ -104,11 +104,13 @@ class Packet extends FTNBase implements \Iterator, \Countable $this->messages = collect(); $this->errors = collect(); $this->domain = NULL; - $this->name = sprintf('%08x',timew()); // If we are creating an outbound packet, we need to set our header - if ($oo && $o) + if ($oo && $o) { + $this->name = sprintf('%08x',timew()); + Log::debug(sprintf('%s:Creating packet [%s]',self::LOGKEY,$this->name)); $this->newHeader($oo,$o); + } } /** diff --git a/app/Classes/File/Send.php b/app/Classes/File/Send.php index 0eb71ce..0909d09 100644 --- a/app/Classes/File/Send.php +++ b/app/Classes/File/Send.php @@ -227,6 +227,7 @@ final class Send extends Item * * @param Address $ao * @throws Exception + * @todo We need to make this into a transaction, incase the transfer fails. */ public function mail(Address $ao): void { diff --git a/app/Classes/Protocol/Binkp.php b/app/Classes/Protocol/Binkp.php index 624eb69..475681f 100644 --- a/app/Classes/Protocol/Binkp.php +++ b/app/Classes/Protocol/Binkp.php @@ -863,6 +863,7 @@ final class Binkp extends BaseProtocol } else { $this->sessionClear(self::SE_WAITGET); + Log::debug(sprintf('%s:Sending packet [%s] as [%s]',self::LOGKEY,$this->send->name,$this->send->sendas)); $this->msgs(self::BPM_FILE,sprintf('%s %lu %ld %lu',$this->send->sendas,$this->send->size,$this->send->mtime,$file['offs'])); } @@ -894,14 +895,17 @@ final class Binkp extends BaseProtocol && $this->send->mtime == Arr::get($file,'file.mtime') && $this->send->size == Arr::get($file,'file.size')) { + // @todo Commit our mail transaction if the remote end confirmed receipt of the file. if ($this->sessionGet(self::SE_SENDFILE)) { - $this->send->close(TRUE); + Log::debug(sprintf('%s:Packet [%s] sent. (%s)',self::LOGKEY,$this->send->sendas,$this->send->name)); $this->sessionClear(self::SE_SENDFILE); + $this->send->close(TRUE); return 1; } if ($this->sessionGet(self::SE_WAITGOT)) { + Log::debug(sprintf('%s:Packet [%s] sent. (%s)',self::LOGKEY,$this->send->sendas,$this->send->name)); $this->sessionClear(self::SE_WAITGOT); $this->send->close(TRUE);