summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Reiss <jreiss@multitech.com>2021-03-04 12:27:17 -0600
committerJason Reiss <jreiss@multitech.com>2021-03-04 12:27:17 -0600
commit991962ded29e379c417f52f19ca36f146a0d836f (patch)
tree2ee552680aed6d619c652f06d1ceb0cd363f4f52
parenta2f4d0d391b19bc5b7c33ed2e36344f298cacc85 (diff)
downloadpacket_forwarder_mtac_full-991962ded29e379c417f52f19ca36f146a0d836f.tar.gz
packet_forwarder_mtac_full-991962ded29e379c417f52f19ca36f146a0d836f.tar.bz2
packet_forwarder_mtac_full-991962ded29e379c417f52f19ca36f146a0d836f.zip
Add periodic restart. PKF will run for about 800 min before stopping and expecting the process be restarted by angel or monit.4.0.6
Gateways have been seen to stop transmitting if left running for several consecutive days, restarting the process restored functionality
-rw-r--r--lora_pkt_fwd/src/lora_pkt_fwd.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/lora_pkt_fwd/src/lora_pkt_fwd.c b/lora_pkt_fwd/src/lora_pkt_fwd.c
index 2969053..a181ea7 100644
--- a/lora_pkt_fwd/src/lora_pkt_fwd.c
+++ b/lora_pkt_fwd/src/lora_pkt_fwd.c
@@ -1994,8 +1994,18 @@ int main(int argc, char** argv)
break;
}
- /* read the currrent temperature */
+ static uint32_t last_tstamp = 0;
+ static uint32_t rollover_cnt = 0;
+ if (trig_tstamp < last_tstamp) {
+ if (rollover_cnt++ > 10) {
+ exit_sig = true;
+ MSG("INFO: periodic restart, process is exiting.\n");
+ break;
+ }
+ }
+ last_tstamp = trig_tstamp;
+ /* read the currrent temperature */
pthread_mutex_unlock(&mx_concent);
if (i != LGW_HAL_SUCCESS) {
printf("# SX1301 time (PPS): unknown\n");