From 68961a7d9c6f1a9b55956e9e11ef24cefceb046a Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 6 Dec 2024 11:05:40 +0800 Subject: [PATCH] Fix: reset still measure speed --- src/chsrc-main.c | 6 +++--- src/framework/core.c | 13 ++++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/chsrc-main.c b/src/chsrc-main.c index 19cef2b..ca989c1 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -528,17 +528,17 @@ get_target (const char *input, TargetOp code, char *option) if (TargetOp_Set_Source==code) { if (target->setfn) target->setfn(option); - else chsrc_error (xy_strjoin (3, "暂未对 ", input, " 实现set功能,邀您帮助: chsrc issue")); + else chsrc_error (xy_strjoin (3, "暂未对 ", input, " 实现 set 功能,邀您帮助: chsrc issue")); } else if (TargetOp_Reset_Source==code) { if (target->resetfn) target->resetfn(option); - else chsrc_error (xy_strjoin (3, "暂未对 ", input, " 实现reset功能,邀您帮助: chsrc issue")); + else chsrc_error (xy_strjoin (3, "暂未对 ", input, " 实现 reset 功能,邀您帮助: chsrc issue")); } else if (TargetOp_Get_Source==code) { if (target->getfn) target->getfn(""); - else chsrc_error (xy_strjoin (3, "暂未对 ", input, " 实现get功能,邀您帮助: chsrc issue")); + else chsrc_error (xy_strjoin (3, "暂未对 ", input, " 实现 get 功能,邀您帮助: chsrc issue")); } else if (TargetOp_List_Config==code) { diff --git a/src/framework/core.c b/src/framework/core.c index 0a0121d..83438ba 100644 --- a/src/framework/core.c +++ b/src/framework/core.c @@ -678,13 +678,15 @@ measure_speed_for_every_source (Source_t sources[], int size, double speed_recor /** * 自动测速选择镜像站和源 - * - * @translation Done */ #define auto_select_mirror(s) select_mirror_autoly(s##_sources, s##_sources_n, (char*)#s+3) int select_mirror_autoly (Source_t *sources, size_t size, const char *target_name) { + /* reset 时选择默认源 */ + if (ProgMode_CMD_Reset) + return 0; + if (!CliOpt_DryRun) { char *msg = CliOpt_InEnglish ? "Measuring speed in sequence" : "测速中"; @@ -701,12 +703,9 @@ select_mirror_autoly (Source_t *sources, size_t size, const char *target_name) } if (CliOpt_DryRun) + /* Dry Run 时,跳过测速 */ { - /* Dry Run 时,跳过测速 */ - if (ProgMode_CMD_Reset) - return 0; /* 选择默认源 */ - else - return 1; /* 原则第一个源 */ + return 1; /* 原则第一个源 */ } bool only_one = false;