Skip to content

Commit

Permalink
Use ping as connectivity check
Browse files Browse the repository at this point in the history
  • Loading branch information
frankdejonge committed Mar 9, 2024
1 parent 4d5aaca commit e019677
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/PhpseclibV3/SimpleConnectivityChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@
namespace League\Flysystem\PhpseclibV3;

use phpseclib3\Net\SFTP;
use Throwable;

class SimpleConnectivityChecker implements ConnectivityChecker
{
public function isConnected(SFTP $connection): bool
{
return $connection->isConnected();
try {
return $connection->ping();
} catch (Throwable) {
return false;
}
}
}

0 comments on commit e019677

Please sign in to comment.