summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-10-28 03:46:41 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2015-10-28 03:46:41 +0100
commita8a852d4b3dbe39bc6ea455b8fa758f843d17541 (patch)
tree468df1bce7d9ea46185d9e2c2e538cbdbc0c0a64
parente41f5032024635faec37cf04e2a9906eeb42cc32 (diff)
downloadxK-a8a852d4b3dbe39bc6ea455b8fa758f843d17541.tar.gz
xK-a8a852d4b3dbe39bc6ea455b8fa758f843d17541.tar.xz
xK-a8a852d4b3dbe39bc6ea455b8fa758f843d17541.zip
degesch: fix reconnect delays
-rw-r--r--degesch.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/degesch.c b/degesch.c
index 99b68b8..694e79f 100644
--- a/degesch.c
+++ b/degesch.c
@@ -3669,15 +3669,18 @@ static int64_t
irc_get_reconnect_delay (struct server *s)
{
int64_t delay = get_config_integer (s->config, "reconnect_delay");
-
int64_t delay_factor = get_config_integer (s->ctx->config.root,
"behaviour.reconnect_delay_growing");
for (unsigned i = 0; i < s->reconnect_attempt; i++)
+ {
+ if (delay_factor && delay > INT64_MAX / delay_factor)
+ break;
delay *= delay_factor;
+ }
int64_t delay_max = get_config_integer (s->ctx->config.root,
"behaviour.reconnect_delay_max");
- return (delay > delay_max || delay < 0) ? delay_max : delay;
+ return MIN (delay, delay_max);
}
static void