Skip to content

Commit

Permalink
Keep connection but improve the check
Browse files Browse the repository at this point in the history
  • Loading branch information
frankdejonge committed Mar 9, 2024
1 parent 6f7baa0 commit 13969af
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/PhpseclibV3/StubSftpConnectionProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ public function disconnect(): void
{
if ($this->connection) {
$this->connection->disconnect();
$this->connection = null;
}
}

public function provideConnection(): SFTP
{
if ( ! $this->connection instanceof SFTP) {
if ( ! $this->connection instanceof SFTP || ! $this->connection->isConnected()) {
$connection = new SftpStub($this->host, $this->port);
$connection->login($this->username, $this->password);

Expand Down

0 comments on commit 13969af

Please sign in to comment.