mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
feat: Wake On LAN
This commit is contained in:
@@ -141,8 +141,7 @@ class ServerProvider extends ChangeNotifier {
|
||||
TryLimiter.reset(s.spi.id);
|
||||
}
|
||||
|
||||
if (!(s.spi.autoConnect ?? true) &&
|
||||
s.conn == ServerConn.disconnected ||
|
||||
if (!(s.spi.autoConnect ?? true) && s.conn == ServerConn.disconnected ||
|
||||
_manualDisconnectedIds.contains(s.spi.id)) {
|
||||
return;
|
||||
}
|
||||
@@ -277,6 +276,23 @@ class ServerProvider extends ChangeNotifier {
|
||||
if (s.needGenClient || (s.client?.isClosed ?? true)) {
|
||||
_setServerState(s, ServerConn.connecting);
|
||||
|
||||
final wol = spi.wolCfg;
|
||||
if (wol != null) {
|
||||
/// TODO: test it
|
||||
try {
|
||||
await wol.wake();
|
||||
} catch (e) {
|
||||
// TryLimiter.inc(sid);
|
||||
// s.status.err = SSHErr(
|
||||
// type: SSHErrType.connect,
|
||||
// message: 'Wake on lan failed: $e',
|
||||
// );
|
||||
// _setServerState(s, ServerConn.failed);
|
||||
// Loggers.app.warning('Wake on lan failed', e);
|
||||
// return;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
final time1 = DateTime.now();
|
||||
s.client = await genClient(
|
||||
|
||||
Reference in New Issue
Block a user