retry stat on timeout

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2018-08-08 16:07:41 +02:00
parent a5985ad0f4
commit 0450406c50
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
1 changed files with 8 additions and 1 deletions

View File

@ -40,6 +40,7 @@ use Icewind\SMB\Exception\Exception;
use Icewind\SMB\Exception\ForbiddenException;
use Icewind\SMB\Exception\InvalidArgumentException;
use Icewind\SMB\Exception\NotFoundException;
use Icewind\SMB\Exception\TimedOutException;
use Icewind\SMB\IFileInfo;
use Icewind\SMB\NativeServer;
use Icewind\SMB\Server;
@ -230,13 +231,19 @@ class SMB extends Common implements INotifyStorage {
return $result;
}
public function stat($path) {
public function stat($path, $retry = true) {
try {
$result = $this->formatInfo($this->getFileInfo($path));
} catch (ForbiddenException $e) {
return false;
} catch (NotFoundException $e) {
return false;
} catch (TimedOutException $e) {
if ($retry) {
return $this->stat($path, false);
} else {
throw $e;
}
}
if ($this->remoteIsShare() && $this->isRootDir($path)) {
$result['mtime'] = $this->shareMTime();