mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 09:14:06 +02:00
respect timeout in native backend
This commit is contained in:
parent
a91de0d012
commit
24e0162914
3 changed files with 6 additions and 3 deletions
|
|
@ -25,7 +25,7 @@ class NativeServer extends AbstractServer {
|
|||
}
|
||||
|
||||
protected function connect() {
|
||||
$this->state->init($this->getAuth());
|
||||
$this->state->init($this->getAuth(), $this->getOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class NativeShare extends AbstractShare {
|
|||
}
|
||||
|
||||
$this->state = new NativeState();
|
||||
$this->state->init($this->server->getAuth());
|
||||
$this->state->init($this->server->getAuth(), $this->server->getOptions());
|
||||
return $this->state;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ use Icewind\SMB\Exception\NotFoundException;
|
|||
use Icewind\SMB\Exception\OutOfSpaceException;
|
||||
use Icewind\SMB\Exception\TimedOutException;
|
||||
use Icewind\SMB\IAuth;
|
||||
use Icewind\SMB\IOptions;
|
||||
|
||||
/**
|
||||
* Low level wrapper for libsmbclient-php with error handling
|
||||
|
|
@ -76,14 +77,16 @@ class NativeState {
|
|||
|
||||
/**
|
||||
* @param IAuth $auth
|
||||
* @param IOptions $options
|
||||
* @return bool
|
||||
*/
|
||||
public function init(IAuth $auth) {
|
||||
public function init(IAuth $auth, IOptions $options) {
|
||||
if ($this->connected) {
|
||||
return true;
|
||||
}
|
||||
$this->state = smbclient_state_new();
|
||||
smbclient_option_set($this->state, SMBCLIENT_OPT_AUTO_ANONYMOUS_LOGIN, false);
|
||||
smbclient_option_set($this->state, SMBCLIENT_OPT_TIMEOUT, $options->getTimeout() * 1000);
|
||||
$auth->setExtraSmbClientOptions($this->state);
|
||||
$result = @smbclient_state_init($this->state, $auth->getWorkgroup(), $auth->getUsername(), $auth->getPassword());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue