Skip to content

Commit 53ddb77

Browse files
committed
Early simple return of connectivity check. Set connection to null on disconnect.
1 parent 438824a commit 53ddb77

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/PhpseclibV3/SftpConnectionProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public function disconnect(): void
8787
{
8888
if ($this->connection) {
8989
$this->connection->disconnect();
90+
$this->connection = null;
9091
}
9192
}
9293

src/PhpseclibV3/SimpleConnectivityChecker.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ class SimpleConnectivityChecker implements ConnectivityChecker
1111
{
1212
public function isConnected(SFTP $connection): bool
1313
{
14+
if ( ! $connection->isConnected()) {
15+
return false;
16+
}
17+
1418
try {
1519
return $connection->ping();
1620
} catch (Throwable) {

0 commit comments

Comments
 (0)