aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJonathan McCrohan <jmccrohan@gmail.com>2012-04-03 23:38:33 +0100
committerJonathan McCrohan <jmccrohan@gmail.com>2012-04-03 23:38:33 +0100
commit39c058cb9a21d8c093fb14a4f4a013195a0eaf88 (patch)
treeef755381f59c68d2cc00d4748a45dba25190818c /src
parentdd425c8ef8952d3a8553029dbbc7d89abd0908df (diff)
downloadverteco-39c058cb9a21d8c093fb14a4f4a013195a0eaf88.tar.gz
modbuslog: increase backoff time
Diffstat (limited to 'src')
-rw-r--r--src/modbuslog.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/modbuslog.c b/src/modbuslog.c
index d967e4a..cb509ea 100644
--- a/src/modbuslog.c
+++ b/src/modbuslog.c
@@ -268,10 +268,12 @@ int main(int argc, char *argv[]) {
if (rc == -1) {
syslog(LOG_ERR, "libmodbus error: [%s]",
modbus_strerror(errno));
- sleep(1);
+ // back off for 2 secs, increasing by 2 for each
+ // incorrect reply
+ sleep(2+retry*2);
}
retry++;
- } while ((rc == -1) && (retry < (modbus_retry + 1)));
+ } while ((rc == -1) && (retry <= modbus_retry));
if (rc == -1){
// retried, but still no luck