diff options
| author | Your Name <[email protected]> | 2023-11-30 09:18:52 +0000 |
|---|---|---|
| committer | Your Name <[email protected]> | 2023-11-30 09:18:52 +0000 |
| commit | 6c0d2e7f1eba17474b593b81ac989e395db5eae5 (patch) | |
| tree | 5d7efafea79528b7f6303030417c27adb5d05e58 /platform/src/hasp_verify.c | |
| parent | 1008d3616e5359854ab1b8eed7adf71efb34e6f1 (diff) | |
Master Process Verify 周期固定为 MASTER_VERF_INTRV_S(10min)
Slave Process Verify 周期 = 传入的时间间隔, 不再是 *2 关系.
Diffstat (limited to 'platform/src/hasp_verify.c')
| -rw-r--r-- | platform/src/hasp_verify.c | 19 |
1 files 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; |
