From 6c0d2e7f1eba17474b593b81ac989e395db5eae5 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 30 Nov 2023 09:18:52 +0000 Subject: [PATCH] =?UTF-8?q?Master=20Process=20Verify=20=E5=91=A8=E6=9C=9F?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E4=B8=BA=20MASTER=5FVERF=5FINTRV=5FS(10min)?= =?UTF-8?q?=20Slave=20Process=20Verify=20=E5=91=A8=E6=9C=9F=20=3D=20?= =?UTF-8?q?=E4=BC=A0=E5=85=A5=E7=9A=84=E6=97=B6=E9=97=B4=E9=97=B4=E9=9A=94?= =?UTF-8?q?,=20=E4=B8=8D=E5=86=8D=E6=98=AF=20*2=20=E5=85=B3=E7=B3=BB.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platform/src/hasp_verify.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/platform/src/hasp_verify.c b/platform/src/hasp_verify.c index 05523c3..f5ee8f0 100644 --- a/platform/src/hasp_verify.c +++ b/platform/src/hasp_verify.c @@ -13,8 +13,9 @@ #include "hasp_vcode.h" #include "hasp_log.h" -#define DEFAULT_INTERVAL_S (15 * 60) -#define MAX_INTERVAL_S (24 * 60 * 60) +#define MASTER_VERF_INTRV_S (10 * 60) +#define DEF_SLAVE_VERF_INTRV_S (15 * 60) +#define MAX_SLAVE_VERF_INTRV_S (24 * 60 * 60) #ifndef MIN #define MIN(a, b) (((a) < (b)) ? (a) : (b)) @@ -484,14 +485,14 @@ void hasp_monitor(uint64_t feature_id, uint64_t interval) uint64_t hasp_monitor_feature_id = feature_id; uint64_t hasp_monitor_interval = interval; - if (hasp_monitor_interval >= MAX_INTERVAL_S) + if (hasp_monitor_interval >= MAX_SLAVE_VERF_INTRV_S) { - hasp_monitor_interval = MAX_INTERVAL_S; + hasp_monitor_interval = MAX_SLAVE_VERF_INTRV_S; } if (hasp_monitor_interval == 0) { - hasp_monitor_interval = DEFAULT_INTERVAL_S; + hasp_monitor_interval = DEF_SLAVE_VERF_INTRV_S; } LOG_INFO("hasp_monitor: Feature ID: %ld, Interval: %ld s", hasp_monitor_feature_id, hasp_monitor_interval); @@ -614,8 +615,10 @@ void hasp_monitor(uint64_t feature_id, uint64_t interval) { goto error_logout; } - - for (int i = 0; !need_stop && i < hasp_monitor_interval; i++) + /** + * STATUS_OK 后, Master Process 固定每隔 MASTER_VERF_INTRV_S 秒检查一次 + */ + for (int i = 0; !need_stop && i < MASTER_VERF_INTRV_S; i++) { sleep(1); } @@ -695,7 +698,7 @@ static void *hasp_verify_cycle(void *arg) goto error_out; } - if (current_timestamp() - temp.timestamp > temp.interval * 2) + if (current_timestamp() - temp.timestamp > temp.interval) { LOG_INFO("hasp_verify: Timestamp not updated for a long time"); goto error_out;