80 lines
2.5 KiB
Diff
80 lines
2.5 KiB
Diff
From a9134b19fc0c942f842a7b51a956347951c89f8b Mon Sep 17 00:00:00 2001
|
|
From: licunlong <licunlong1@huawei.com>
|
|
Date: Wed, 14 Jun 2023 17:24:08 +0800
|
|
Subject: [PATCH] fix: really use usec
|
|
|
|
watchdog_usec was actually watchdog_sec formerly
|
|
---
|
|
coms/service/src/mng.rs | 14 +++++++-------
|
|
coms/service/src/spawn.rs | 2 +-
|
|
2 files changed, 8 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/coms/service/src/mng.rs b/coms/service/src/mng.rs
|
|
index 5c71531..bfa2c9f 100644
|
|
--- a/coms/service/src/mng.rs
|
|
+++ b/coms/service/src/mng.rs
|
|
@@ -1233,9 +1233,9 @@ impl ServiceMng {
|
|
}
|
|
|
|
fn restart_watchdog(&self) {
|
|
- self.monitor
|
|
- .borrow_mut()
|
|
- .set_original_watchdog(self.config.config_data().borrow().Service.WatchdogSec);
|
|
+ self.monitor.borrow_mut().set_original_watchdog(
|
|
+ self.config.config_data().borrow().Service.WatchdogSec * 1000000,
|
|
+ );
|
|
let watchdog_usec = self.monitor.borrow().watchdog_usec();
|
|
if watchdog_usec == 0 || watchdog_usec == u64::MAX {
|
|
self.stop_watchdog();
|
|
@@ -2455,7 +2455,7 @@ impl Source for ServiceTimer {
|
|
struct ServiceMonitorData {
|
|
mng: RefCell<Weak<ServiceMng>>,
|
|
// owned objects
|
|
- time: RefCell<u64>,
|
|
+ time: RefCell<u64>, /* usec */
|
|
}
|
|
|
|
// the declaration "pub(self)" is for identification only.
|
|
@@ -2511,7 +2511,7 @@ impl Source for ServiceMonitorData {
|
|
}
|
|
|
|
fn time_relative(&self) -> u64 {
|
|
- *self.time.borrow() * 1000000
|
|
+ *self.time.borrow()
|
|
}
|
|
|
|
fn dispatch(&self, _: &Events) -> i32 {
|
|
@@ -2575,7 +2575,7 @@ mod tests {
|
|
assert!(rt.armd_watchdog());
|
|
assert_eq!(
|
|
rt.watchdog().time(),
|
|
- config.config_data().borrow().Service.WatchdogSec
|
|
+ config.config_data().borrow().Service.WatchdogSec * 1000000
|
|
);
|
|
}
|
|
|
|
@@ -2594,7 +2594,7 @@ mod tests {
|
|
assert!(rt.armd_watchdog());
|
|
assert_eq!(
|
|
rt.watchdog().time(),
|
|
- config.config_data().borrow().Service.WatchdogSec
|
|
+ config.config_data().borrow().Service.WatchdogSec * 1000000
|
|
);
|
|
|
|
messages.remove("WATCHDOG");
|
|
diff --git a/coms/service/src/spawn.rs b/coms/service/src/spawn.rs
|
|
index 9b895aa..2ff9e92 100644
|
|
--- a/coms/service/src/spawn.rs
|
|
+++ b/coms/service/src/spawn.rs
|
|
@@ -164,6 +164,6 @@ impl ServiceSpawn {
|
|
}
|
|
|
|
fn watchdog_timer(&self) -> u64 {
|
|
- self.config.config_data().borrow().Service.WatchdogSec
|
|
+ self.config.config_data().borrow().Service.WatchdogSec * 1000000
|
|
}
|
|
}
|
|
--
|
|
2.30.2
|
|
|