diff --git a/app/Classes/Protocol/EMSI.php b/app/Classes/Protocol/EMSI.php index 8cb8d94..df35492 100644 --- a/app/Classes/Protocol/EMSI.php +++ b/app/Classes/Protocol/EMSI.php @@ -346,12 +346,6 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface } else { $this->node->optionSet(self::O_PWD); Log::info(sprintf('%s: - Remote Authed [%d] AKAs',__METHOD__,$c)); - - // Add our mail to the queue if we have authenticated - if ($this->node->aka_authed) - foreach ($this->node->aka_remote as $ao) { - $this->send->mail($ao); - } } /* Link codes */ @@ -1154,7 +1148,8 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface { Log::debug(sprintf('%s: + Start',__METHOD__)); - $rc = (new Zmodem)->zmodem_receive($this->client,$zap,$this->recv); + // @todo If the node is not defined in the DB node->address is NULL. Need to figure out how to handle those nodes. + $rc = (new Zmodem)->zmodem_receive($this->client,$zap,$this->recv,$this->node->address); return ($rc == self::RCDO || $rc == self::ERROR); } @@ -1170,6 +1165,13 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface { Log::debug(sprintf('%s: + Start [%d]',__METHOD__,$zap)); + // See if there is anything to add to the outbound + // Add our mail to the queue if we have authenticated + if ($this->node->aka_authed) + foreach ($this->node->aka_remote as $ao) { + $this->send->mail($ao); + } + $z = new Zmodem; if (! $z->zmodem_sendinit($this->client,$zap) && $this->send->total_count) diff --git a/app/Classes/Protocol/Zmodem.php b/app/Classes/Protocol/Zmodem.php index 904d060..500c0ca 100644 --- a/app/Classes/Protocol/Zmodem.php +++ b/app/Classes/Protocol/Zmodem.php @@ -11,6 +11,7 @@ use App\Classes\File\{Receive,Send}; use App\Classes\Sock\{SocketClient,SocketException}; use App\Interfaces\CRC as CRCInterface; use App\Interfaces\Zmodem as ZmodemInterface; +use App\Models\Address; use App\Traits\CRC as CRCTrait; final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface @@ -274,7 +275,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface $rc = $this->zmodem_senddone(); } else { - $rc = $this->zmodem_receive($this->client,$proto,$this->recv); + $rc = $this->zmodem_receive($this->client,$proto,$this->recv,$this->node->address); } return $rc;