Fix: reset still measure speed

This commit is contained in:
Aoran Zeng 2024-12-06 11:05:40 +08:00
parent 5ec75b379a
commit 68961a7d9c
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
2 changed files with 9 additions and 10 deletions

View File

@ -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)
{

View File

@ -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;