From 0450406c5042881f79407230863d3e15222eb849 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 8 Aug 2018 16:07:41 +0200 Subject: [PATCH] retry stat on timeout Signed-off-by: Robin Appelman --- apps/files_external/lib/Lib/Storage/SMB.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php index 40fffce83424d..dfe7df9349d6b 100644 --- a/apps/files_external/lib/Lib/Storage/SMB.php +++ b/apps/files_external/lib/Lib/Storage/SMB.php @@ -40,6 +40,7 @@ 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 @@ public function rename($source, $target, $retry = true) { 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();