Some debugging to track packet names created for sending

This commit is contained in:
Deon George 2022-01-20 22:47:44 +11:00
parent 421cd565bd
commit 98c9b880d4
3 changed files with 10 additions and 3 deletions
app/Classes

View File

@ -104,12 +104,14 @@ class Packet extends FTNBase implements \Iterator, \Countable
$this->messages = collect(); $this->messages = collect();
$this->errors = collect(); $this->errors = collect();
$this->domain = NULL; $this->domain = NULL;
$this->name = sprintf('%08x',timew());
// If we are creating an outbound packet, we need to set our header // 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); $this->newHeader($oo,$o);
} }
}
/** /**
* Open a packet file * Open a packet file

View File

@ -227,6 +227,7 @@ final class Send extends Item
* *
* @param Address $ao * @param Address $ao
* @throws Exception * @throws Exception
* @todo We need to make this into a transaction, incase the transfer fails.
*/ */
public function mail(Address $ao): void public function mail(Address $ao): void
{ {

View File

@ -863,6 +863,7 @@ final class Binkp extends BaseProtocol
} else { } else {
$this->sessionClear(self::SE_WAITGET); $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'])); $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->mtime == Arr::get($file,'file.mtime')
&& $this->send->size == Arr::get($file,'file.size')) && $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)) { 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->sessionClear(self::SE_SENDFILE);
$this->send->close(TRUE);
return 1; return 1;
} }
if ($this->sessionGet(self::SE_WAITGOT)) { 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->sessionClear(self::SE_WAITGOT);
$this->send->close(TRUE); $this->send->close(TRUE);