Commit 5661b82b authored by Ivan Tyagov's avatar Ivan Tyagov

Define timeout as a const.

parent 8e1c9e19
...@@ -5,6 +5,9 @@ static unsigned int HEART_BEATS = 0; ...@@ -5,6 +5,9 @@ static unsigned int HEART_BEATS = 0;
const int DEFAULT_HEART_BEAT_INTERVAL = 250; const int DEFAULT_HEART_BEAT_INTERVAL = 250;
static int HEART_BEAT_INTERVAL = DEFAULT_HEART_BEAT_INTERVAL; static int HEART_BEAT_INTERVAL = DEFAULT_HEART_BEAT_INTERVAL;
// the timeout in millis after which a coupler is considered down
const int DEFAULT_HEART_BEAT_TIMEOUT_INTERVAL = 4 * DEFAULT_HEART_BEAT_INTERVAL;
// the list of couplers onto which we depend for properly running$ // the list of couplers onto which we depend for properly running$
// XXX: assume ONLY 8 couplers! // XXX: assume ONLY 8 couplers!
unsigned int HEART_BEAT_ID_LIST[] = {0, 0, 0, 0, 0, 0, 0, 0}; unsigned int HEART_BEAT_ID_LIST[] = {0, 0, 0, 0, 0, 0, 0, 0};
......
...@@ -276,7 +276,7 @@ void callbackCheckHeartBeat() { ...@@ -276,7 +276,7 @@ void callbackCheckHeartBeat() {
// we do have timestamp for this coupler ID // we do have timestamp for this coupler ID
int last_seen_timestamp_int = atoi(last_seen_timestamp); int last_seen_timestamp_int = atoi(last_seen_timestamp);
int timestamp_delta = milli_seconds - last_seen_timestamp_int; int timestamp_delta = milli_seconds - last_seen_timestamp_int;
bool is_down = (timestamp_delta > 1000); bool is_down = (timestamp_delta > DEFAULT_HEART_BEAT_TIMEOUT_INTERVAL);
if (is_down) { if (is_down) {
UA_LOG_INFO(UA_Log_Stdout, \ UA_LOG_INFO(UA_Log_Stdout, \
UA_LOGCATEGORY_USERLAND, \ UA_LOGCATEGORY_USERLAND, \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment