summaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
Diffstat (limited to 'degesch.c')
-rw-r--r--degesch.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/degesch.c b/degesch.c
index 0f703cc..ebc24c0 100644
--- a/degesch.c
+++ b/degesch.c
@@ -4151,7 +4151,7 @@ start:
return IRC_READ_ERROR;
}
-static bool irc_connect (struct server *s, struct error **);
+static bool irc_connect (struct server *s, bool *should_retry, struct error **);
static void irc_queue_reconnect (struct server *s);
static void
@@ -4168,12 +4168,15 @@ on_irc_reconnect_timeout (void *user_data)
struct server *s = user_data;
struct error *e = NULL;
- if (irc_connect (s, &e))
+ bool should_retry = false;
+ if (irc_connect (s, &should_retry, &e))
return;
buffer_send_error (s->ctx, s->buffer, "%s", e->message);
error_free (e);
- irc_queue_reconnect (s);
+
+ if (should_retry)
+ irc_queue_reconnect (s);
}
static void
@@ -4304,10 +4307,11 @@ end:
}
static bool
-irc_connect (struct server *s, struct error **e)
+irc_connect (struct server *s, bool *should_retry, struct error **e)
{
// TODO: connect asynchronously so that we don't freeze
struct app_context *ctx = s->ctx;
+ *should_retry = true;
const char *irc_host = get_config_string (ctx, "server.irc_host");
int64_t irc_port_int = get_config_integer (ctx, "server.irc_port");
@@ -4315,6 +4319,7 @@ irc_connect (struct server *s, struct error **e)
if (!get_config_string (ctx, "server.irc_host"))
{
error_set (e, "No hostname specified in configuration");
+ *should_retry = false;
return false;
}