Implement M_SKIP in binkp protocol
This commit is contained in:
parent
967aadf21d
commit
2456402246
@ -489,6 +489,11 @@ final class Binkp extends BaseProtocol
|
|||||||
$rc = $this->M_get($data);
|
$rc = $this->M_get($data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case self::BPM_SKIP:
|
||||||
|
Log::debug(sprintf('%s:- SKIP:Remote requested to skip file [%s]',self::LOGKEY,$data));
|
||||||
|
$rc = $this->M_skip($data);
|
||||||
|
break;
|
||||||
|
|
||||||
case self::BPM_GOTSKIP:
|
case self::BPM_GOTSKIP:
|
||||||
Log::debug(sprintf('%s:- GOT:Remote received, or already has a file [%s]',self::LOGKEY,$data));
|
Log::debug(sprintf('%s:- GOT:Remote received, or already has a file [%s]',self::LOGKEY,$data));
|
||||||
$rc = $this->M_gotskip($data);
|
$rc = $this->M_gotskip($data);
|
||||||
@ -1008,7 +1013,45 @@ final class Binkp extends BaseProtocol
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* M_GOT/M_SKIP commands
|
* M_SKIP commands
|
||||||
|
*
|
||||||
|
* @param string $buf
|
||||||
|
* @return bool
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
|
private function M_skip(string $buf): bool
|
||||||
|
{
|
||||||
|
Log::info(sprintf('%s:+ Remote request to skip the file for now [%s]',self::LOGKEY,$buf));
|
||||||
|
|
||||||
|
if ($file = $this->file_parse($buf)) {
|
||||||
|
if ($this->send->nameas
|
||||||
|
&& ! strncasecmp(Arr::get($file,'file.name'),$this->send->nameas,self::MAX_PATH)
|
||||||
|
&& $this->send->mtime === Arr::get($file,'file.mtime')
|
||||||
|
&& $this->send->size === Arr::get($file,'file.size'))
|
||||||
|
{
|
||||||
|
if ((! $this->sessionGet(self::SE_SENDFILE)) && (! $this->sessionGet(self::SE_WAITGOT))) {
|
||||||
|
Log::error(sprintf('%s:! M_skip for unknown file [%s]',self::LOGKEY,$buf));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Log::info(sprintf('%s:= Packet/File [%s], type [%d] skipped.',self::LOGKEY,$this->send->nameas,$this->send->type));
|
||||||
|
$this->sessionClear(self::SE_WAITGOT|self::SE_SENDFILE);
|
||||||
|
|
||||||
|
$this->send->close(FALSE,$this->node);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Log::error(sprintf('%s:! M_skip not for our file? [%s]',self::LOGKEY,$buf));
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Log::error(sprintf('%s:! UNPARSABLE file info [%s]',self::LOGKEY,$buf));
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* M_GOTSKIP command
|
||||||
*
|
*
|
||||||
* @param string $buf
|
* @param string $buf
|
||||||
* @return bool
|
* @return bool
|
||||||
|
Loading…
Reference in New Issue
Block a user