aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2019-09-27 12:29:56 +0200
committerGitHub <noreply@github.com>2019-09-27 12:29:56 +0200
commit88b6dc5eaf28b1bfe72a62773e8a9ce339979ea3 (patch)
tree0d4d6586c75ccf214efc5c774353727064169c6c /apps/files_external/lib
parentf23d49266f2184760647109e697b6e1efa470eef (diff)
parentbc160992d3d73317ffa7c9c22d5746273bb7e14c (diff)
downloadnextcloud-server-88b6dc5eaf28b1bfe72a62773e8a9ce339979ea3.tar.gz
nextcloud-server-88b6dc5eaf28b1bfe72a62773e8a9ce339979ea3.zip
Merge pull request #17258 from nextcloud/smb-timeout-config
add (hidden) option to configure smb timeout
Diffstat (limited to 'apps/files_external/lib')
-rw-r--r--apps/files_external/lib/Lib/Backend/SMB.php2
-rw-r--r--apps/files_external/lib/Lib/Storage/SMB.php10
2 files changed, 11 insertions, 1 deletions
diff --git a/apps/files_external/lib/Lib/Backend/SMB.php b/apps/files_external/lib/Lib/Backend/SMB.php
index 0543247051f..a1fcd7fe305 100644
--- a/apps/files_external/lib/Lib/Backend/SMB.php
+++ b/apps/files_external/lib/Lib/Backend/SMB.php
@@ -53,6 +53,8 @@ class SMB extends Backend {
(new DefinitionParameter('show_hidden', $l->t('Show hidden files')))
->setType(DefinitionParameter::VALUE_BOOLEAN)
->setFlag(DefinitionParameter::FLAG_OPTIONAL),
+ (new DefinitionParameter('timeout', $l->t('Timeout')))
+ ->setType(DefinitionParameter::VALUE_HIDDEN)
])
->addAuthScheme(AuthMechanism::SCHEME_PASSWORD)
->addAuthScheme(AuthMechanism::SCHEME_SMB)
diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php
index 85b4e620755..cd6ef5c2139 100644
--- a/apps/files_external/lib/Lib/Storage/SMB.php
+++ b/apps/files_external/lib/Lib/Storage/SMB.php
@@ -44,6 +44,7 @@ use Icewind\SMB\Exception\NotFoundException;
use Icewind\SMB\Exception\TimedOutException;
use Icewind\SMB\IFileInfo;
use Icewind\SMB\Native\NativeServer;
+use Icewind\SMB\Options;
use Icewind\SMB\ServerFactory;
use Icewind\SMB\System;
use Icewind\Streams\CallbackWrapper;
@@ -106,7 +107,14 @@ class SMB extends Common implements INotifyStorage {
$this->logger = \OC::$server->getLogger();
}
- $serverFactory = new ServerFactory();
+ $options = new Options();
+ if (isset($params['timeout'])) {
+ $timeout = (int)$params['timeout'];
+ if ($timeout > 0) {
+ $options->setTimeout($timeout);
+ }
+ }
+ $serverFactory = new ServerFactory($options);
$this->server = $serverFactory->createServer($params['host'], $auth);
$this->share = $this->server->getShare(trim($params['share'], '/'));