mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
new: custom timeout
This commit is contained in:
@@ -46,14 +46,16 @@ Future<SSHClient> genClient(
|
||||
ServerPrivateInfo spi, {
|
||||
void Function(GenSSHClientStatus)? onStatus,
|
||||
String? privateKey,
|
||||
Duration? timeout,
|
||||
}) async {
|
||||
onStatus?.call(GenSSHClientStatus.socket);
|
||||
late SSHSocket socket;
|
||||
final duration = timeout ?? const Duration(seconds: 5);
|
||||
try {
|
||||
socket = await SSHSocket.connect(
|
||||
spi.ip,
|
||||
spi.port,
|
||||
timeout: const Duration(seconds: 5),
|
||||
timeout: duration,
|
||||
);
|
||||
} catch (e) {
|
||||
if (spi.alterUrl == null) rethrow;
|
||||
@@ -62,7 +64,7 @@ Future<SSHClient> genClient(
|
||||
socket = await SSHSocket.connect(
|
||||
ipPort.ip,
|
||||
ipPort.port,
|
||||
timeout: const Duration(seconds: 5),
|
||||
timeout: duration,
|
||||
);
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
|
||||
Reference in New Issue
Block a user