fix: 内置 dartssh2 2.11.0 补丁版(third_party 本地依赖),修复新版 Dart SDK 下 sftp_client 编译错误
This commit is contained in:
1 parent
6daa9dd361
commit
0a33fabec2
139 files changed
+16497
-1
No files matched your search
+27
@@ -0,0 +1,27 @@
|
||||
import 'dart:async';
|
||||
|
||||
/// A wrapper around [Timer] that calls [ping] every [interval], and can be
|
||||
/// started or stopped idempotently.
|
||||
class SSHKeepAlive {
|
||||
Timer? _timer;
|
||||
|
||||
final Duration interval;
|
||||
|
||||
final Future Function() ping;
|
||||
|
||||
SSHKeepAlive({
|
||||
required this.ping,
|
||||
this.interval = const Duration(seconds: 10),
|
||||
});
|
||||
|
||||
void start() {
|
||||
_timer ??= Timer.periodic(interval, (timer) async {
|
||||
await ping();
|
||||
});
|
||||
}
|
||||
|
||||
void stop() {
|
||||
_timer?.cancel();
|
||||
_timer = null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user