Skip to content

Commit a2b84ba

Browse files
committed
feat: Enable configurable proxy connection retry count
- Add Retry Count setting to SettingDialog - Pass configured retry count to ProxyCheckerService - Update default retry count to 5
1 parent ea9725b commit a2b84ba

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

Dialogs/Models/SettingModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public partial class SettingModel : ObservableObject, IDialogContext
1919
[ObservableProperty] private int _proxyType; // 0=HTTP, 1=SOCKS4, 2=SOCKS5
2020
[ObservableProperty] private int _timeout = 10; // 默认10秒
2121
[ObservableProperty] private int _concurrency = 50; // 默认50线程
22+
[ObservableProperty] private int _retryCount = 5; // 默认重试1次
2223
[ObservableProperty] private bool _autoSave = true; // 默认自动保存
2324

2425
public void Close()

Dialogs/Views/SettingDialog.axaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@
4646
u:FormItem.Label="连接超时(秒)"
4747
ToolTip.Tip="代理连接超时时间" />
4848

49+
<u:NumericIntUpDown Width="100"
50+
Minimum="0"
51+
Maximum="10"
52+
HorizontalAlignment="Left"
53+
HorizontalContentAlignment="Center"
54+
Value="{Binding RetryCount}"
55+
u:FormItem.Label="重试次数"
56+
ToolTip.Tip="连接失败后的重试次数" />
57+
4958
<CheckBox IsChecked="{Binding AutoSave}"
5059
u:FormItem.Label="自动保存"
5160
ToolTip.Tip="检测完成后自动保存结果到文件" />

ViewModels/MainViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ private async Task StartAsync()
371371

372372
ResetRunState();
373373
var ct = StartRun();
374-
var service = new ProxyCheckerService(GlobalSetting.Instance.Setting.Timeout);
374+
var service = new ProxyCheckerService(GlobalSetting.Instance.Setting.Timeout, GlobalSetting.Instance.Setting.RetryCount);
375375

376376
try
377377
{

0 commit comments

Comments
 (0)