Optimised our sending and receiving of items
This commit is contained in:
@@ -272,7 +272,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface
|
||||
$proto = $this->originate ? $this->node->optionGet(self::P_MASK) : $this->optionGet(self::P_MASK);
|
||||
|
||||
if ($this->originate) {
|
||||
if (! $z->zmodem_sendinit($this->client,$proto) && $this->send->total_count)
|
||||
if (! $z->zmodem_sendinit($this->client,$proto) && $this->send->togo_count)
|
||||
$this->zmodem_sendfile($this->send);
|
||||
|
||||
$rc = $this->zmodem_senddone();
|
||||
@@ -304,7 +304,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface
|
||||
if ($canzap&0x0100)
|
||||
$opts |= self::LSZ_OPTFIRSTBATCH;
|
||||
|
||||
switch ($rc=$this->ls_zrecvfinfo(self::ZRINIT,($this->ls_Protocol&self::LSZ_OPTFIRSTBATCH) ? 1 : 0)) {
|
||||
switch ($rc=$this->ls_zrecvfinfo(self::ZRINIT,($this->ls_Protocol&self::LSZ_OPTFIRSTBATCH) ? 1 : 0,$ao)) {
|
||||
case self::ZFIN:
|
||||
Log::debug(sprintf('%s:= zmodem_receive ZFIN after INIT, empty batch',self::LOGKEY));
|
||||
$this->ls_zdonereceiver();
|
||||
@@ -333,13 +333,13 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface
|
||||
return self::OK;
|
||||
|
||||
case self::ZFILE:
|
||||
if (! $this->recv->to_get) {
|
||||
if (! $this->recv->togo_count) {
|
||||
Log::error(sprintf('%s: ! zmodem_receive No files to get?',self::LOGKEY));
|
||||
|
||||
$frame = self::ZSKIP;
|
||||
|
||||
} else {
|
||||
switch ($this->recv->open($ao)) {
|
||||
switch ($this->recv->open()) {
|
||||
case self::FOP_SKIP:
|
||||
Log::info(sprintf('%s: = zmodem_receive Skip this file [%s]',self::LOGKEY,$this->recv->name));
|
||||
$frame = self::ZSKIP;
|
||||
@@ -408,7 +408,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface
|
||||
return self::ERROR;
|
||||
}
|
||||
|
||||
$rc = $this->ls_zrecvfinfo($frame,1);
|
||||
$rc = $this->ls_zrecvfinfo($frame,1,$ao);
|
||||
}
|
||||
|
||||
return self::OK;
|
||||
@@ -504,9 +504,9 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface
|
||||
{
|
||||
Log::debug(sprintf('%s:+ zmodem_sendfile',self::LOGKEY));
|
||||
|
||||
while ($send->total_count && $send->open()) {
|
||||
while ($send->togo_count && $send->open()) {
|
||||
try {
|
||||
$rc = $this->ls_zsendfile($send,$this->ls_SerialNum++,$send->total_count,$send->total_size);
|
||||
$rc = $this->ls_zsendfile($send,$this->ls_SerialNum++,$send->togo_count,$send->total_size);
|
||||
|
||||
switch ($rc) {
|
||||
case self::OK:
|
||||
@@ -1363,7 +1363,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface
|
||||
* @return int
|
||||
* @throws \Exception
|
||||
*/
|
||||
private function ls_zrecvfinfo(int $frame,int $first): int
|
||||
private function ls_zrecvfinfo(int $frame,int $first,Address $ao): int
|
||||
{
|
||||
Log::debug(sprintf('%s:+ ls_zrecvfinfo - Frame [%d], First [%d]',self::LOGKEY,$frame,$first));
|
||||
|
||||
@@ -1478,7 +1478,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface
|
||||
$filesleft = -1;
|
||||
|
||||
} else {
|
||||
$this->recv->new($file);
|
||||
$this->recv->new($file,$ao);
|
||||
}
|
||||
|
||||
return self::ZFILE;
|
||||
@@ -2390,7 +2390,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface
|
||||
$buf = '';
|
||||
|
||||
$this->client->tx_purge();
|
||||
$buf = $send->sendas.chr(0);
|
||||
$buf = $send->nameas.chr(0);
|
||||
|
||||
$buf .= sprintf('%ld %lo %o %o %ld %ld',
|
||||
$send->size,
|
||||
|
Reference in New Issue
Block a user