Move the send DB updates out of the protocol and into Send::class

This commit is contained in:
2023-07-19 12:32:41 +10:00
parent 7584e3e44e
commit f4fc6c24a4
6 changed files with 67 additions and 58 deletions

View File

@@ -4,7 +4,7 @@ namespace App\Classes\Protocol;
use Illuminate\Support\Facades\Log;
use App\Classes\Protocol;
use App\Classes\{Node,Protocol};
use App\Classes\Protocol\Zmodem as ZmodemClass;
use App\Classes\File\{Receive,Send};
use App\Classes\Sock\{SocketClient,SocketException};
@@ -509,7 +509,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface
* @param Send $send
* @return int
*/
public function zmodem_sendfile(Send $send): int
public function zmodem_sendfile(Send $send,Node $node): int
{
Log::debug(sprintf('%s:+ zmodem_sendfile',self::LOGKEY));
@@ -519,16 +519,16 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface
switch ($rc) {
case self::OK:
$send->close(TRUE);
case self::ZSKIP:
$send->close(TRUE,$node);
break;
case self::ZSKIP:
case self::ZFERR:
$send->close(FALSE);
$send->close(FALSE,$node);
break;
default:
$send->close(FALSE);
$send->close(FALSE,$node);
$this->ls_zabort();
break;
}
@@ -2143,7 +2143,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface
$trys = 0;
$needack = 0;
switch (($rc = $this->ls_zsendfinfo($send,$sernum,$send->pos,$fileleft,$bytesleft))) {
switch (($rc=$this->ls_zsendfinfo($send,$sernum,$send->pos,$fileleft,$bytesleft))) {
/* Ok, It's OK! */
case self::ZRPOS:
Log::debug(sprintf('%s: - ls_zsendfile ZRPOS to [%d]',self::LOGKEY,$send->pos));
@@ -2152,6 +2152,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface
/* Skip it */
case self::ZSKIP:
/* Suspend it */
// @todo Should ZFERR be next to ZABORT?
case self::ZFERR:
// @todo Mark the file as skipped
Log::debug(sprintf('%s: - ls_zsendfile ZSKIP/ZFERR',self::LOGKEY));