Skip to content

Commit 88b6dc5

Browse files
authored
Merge pull request #17258 from nextcloud/smb-timeout-config
add (hidden) option to configure smb timeout
2 parents f23d492 + bc16099 commit 88b6dc5

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

apps/files_external/lib/Lib/Backend/SMB.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ public function __construct(IL10N $l, Password $legacyAuth) {
5353
(new DefinitionParameter('show_hidden', $l->t('Show hidden files')))
5454
->setType(DefinitionParameter::VALUE_BOOLEAN)
5555
->setFlag(DefinitionParameter::FLAG_OPTIONAL),
56+
(new DefinitionParameter('timeout', $l->t('Timeout')))
57+
->setType(DefinitionParameter::VALUE_HIDDEN)
5658
])
5759
->addAuthScheme(AuthMechanism::SCHEME_PASSWORD)
5860
->addAuthScheme(AuthMechanism::SCHEME_SMB)

apps/files_external/lib/Lib/Storage/SMB.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
use Icewind\SMB\Exception\TimedOutException;
4545
use Icewind\SMB\IFileInfo;
4646
use Icewind\SMB\Native\NativeServer;
47+
use Icewind\SMB\Options;
4748
use Icewind\SMB\ServerFactory;
4849
use Icewind\SMB\System;
4950
use Icewind\Streams\CallbackWrapper;
@@ -106,7 +107,14 @@ public function __construct($params) {
106107
$this->logger = \OC::$server->getLogger();
107108
}
108109

109-
$serverFactory = new ServerFactory();
110+
$options = new Options();
111+
if (isset($params['timeout'])) {
112+
$timeout = (int)$params['timeout'];
113+
if ($timeout > 0) {
114+
$options->setTimeout($timeout);
115+
}
116+
}
117+
$serverFactory = new ServerFactory($options);
110118
$this->server = $serverFactory->createServer($params['host'], $auth);
111119
$this->share = $this->server->getShare(trim($params['share'], '/'));
112120

0 commit comments

Comments
 (0)