Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f89fe8b29 | ||
|
|
78081a12e8 |
Submodule core/Clash.Meta updated: d1dc1e4433...1c46eb82bf
@@ -175,8 +175,10 @@ func patchConfig(general *config.General) {
|
||||
|
||||
const concurrentCount = math.MaxInt
|
||||
|
||||
var wg = sync.WaitGroup{}
|
||||
var exit = make(chan struct{})
|
||||
|
||||
func hcCompatibleProvider(proxyProviders map[string]provider.ProxyProvider) {
|
||||
wg := sync.WaitGroup{}
|
||||
ch := make(chan struct{}, concurrentCount)
|
||||
for _, proxyProvider := range proxyProviders {
|
||||
proxyProvider := proxyProvider
|
||||
@@ -184,6 +186,11 @@ func hcCompatibleProvider(proxyProviders map[string]provider.ProxyProvider) {
|
||||
log.Infoln("Start initial Compatible provider %s", proxyProvider.Name())
|
||||
wg.Add(1)
|
||||
ch <- struct{}{}
|
||||
select {
|
||||
case <-exit:
|
||||
return // 收到退出信号,退出协程
|
||||
default:
|
||||
}
|
||||
go func() {
|
||||
defer func() { <-ch; wg.Done() }()
|
||||
if err := proxyProvider.Initial(); err != nil {
|
||||
@@ -193,7 +200,13 @@ func hcCompatibleProvider(proxyProviders map[string]provider.ProxyProvider) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func cancelHc() {
|
||||
close(exit)
|
||||
wg.Wait()
|
||||
exit = make(chan struct{})
|
||||
wg = sync.WaitGroup{}
|
||||
}
|
||||
|
||||
func applyConfig(isPatch bool) {
|
||||
@@ -205,5 +218,6 @@ func applyConfig(isPatch bool) {
|
||||
patchConfig(cfg.General)
|
||||
} else {
|
||||
executor.ApplyConfig(cfg, true)
|
||||
healthcheck()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,6 +120,10 @@ func changeProxy(s *C.char) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// clearEffect
|
||||
func clearConfigEffect() {
|
||||
}
|
||||
|
||||
//export getTraffic
|
||||
func getTraffic() *C.char {
|
||||
up, down := statistic.DefaultManager.Now()
|
||||
|
||||
@@ -236,7 +236,6 @@ class AppController {
|
||||
}
|
||||
|
||||
healthcheck() {
|
||||
if (globalState.healthcheckLock) return;
|
||||
for (final delay in appState.delayMap.entries) {
|
||||
setDelay(
|
||||
Delay(
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:fl_clash/common/common.dart';
|
||||
import 'package:fl_clash/enum/enum.dart';
|
||||
import 'package:fl_clash/models/models.dart';
|
||||
import 'package:fl_clash/widgets/widgets.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -24,6 +25,11 @@ class _NetworkDetectionState extends State<NetworkDetection> {
|
||||
),
|
||||
);
|
||||
}
|
||||
if (currentProxyName == UsedProxy.DIRECT.name) {
|
||||
return const Icon(
|
||||
Icons.offline_bolt_outlined,
|
||||
);
|
||||
}
|
||||
if (delay == 0 || delay == null) {
|
||||
return const AspectRatio(
|
||||
aspectRatio: 1,
|
||||
|
||||
@@ -51,7 +51,7 @@ class _StartButtonState extends State<StartButton>
|
||||
final appController = context.appController;
|
||||
await appController.updateSystemProxy(isStart);
|
||||
if (isStart && mounted) {
|
||||
appController.clearCurrentDelay();
|
||||
appController.healthcheck();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,11 @@ class _ProxiesFragmentState extends State<ProxiesFragment>
|
||||
);
|
||||
},
|
||||
builder: (_, state, __) {
|
||||
_tabController ??= TabController(
|
||||
if (_tabController != null) {
|
||||
_tabController!.dispose();
|
||||
_tabController = null;
|
||||
}
|
||||
_tabController = TabController(
|
||||
length: state.groupNames.length,
|
||||
vsync: this,
|
||||
initialIndex: state.currentIndex,
|
||||
|
||||
@@ -23,7 +23,6 @@ class GlobalState {
|
||||
List<Function> updateFunctionLists = [];
|
||||
List<NavigationItem> currentNavigationItems = [];
|
||||
bool updatePackagesLock = false;
|
||||
bool healthcheckLock = false;
|
||||
|
||||
startListenUpdate() {
|
||||
if (timer != null && timer!.isActive == true) return;
|
||||
|
||||
@@ -38,14 +38,12 @@ class _ClashMessageContainerState extends State<ClashMessageContainer>
|
||||
|
||||
@override
|
||||
void onDelay(Delay delay) {
|
||||
globalState.healthcheckLock = true;
|
||||
context.appController.setDelay(delay);
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
globalState.updateSortNumDebounce ??= debounce<Function()>(
|
||||
() {
|
||||
context.appController.updateGroups();
|
||||
context.appController.appState.sortNum++;
|
||||
globalState.healthcheckLock = false;
|
||||
},
|
||||
milliseconds: 5000,
|
||||
);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name: fl_clash
|
||||
description: A multi-platform proxy client based on ClashMeta, simple and easy to use, open-source and ad-free.
|
||||
publish_to: 'none'
|
||||
version: 0.7.10
|
||||
version: 0.7.12
|
||||
environment:
|
||||
sdk: '>=3.1.0 <4.0.0'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user