aboutsummaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-05-03 00:12:39 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-05-03 00:13:36 +0200
commit1019cc69b2909622f3c6d5a76addbcb70a94ef8f (patch)
tree54c26044c234b10d20efc3977c1bfcc1634a4d2a /degesch.c
parentb31104784cbb6f88f144289c90340d95f1c849e5 (diff)
downloadxK-1019cc69b2909622f3c6d5a76addbcb70a94ef8f.tar.gz
xK-1019cc69b2909622f3c6d5a76addbcb70a94ef8f.tar.xz
xK-1019cc69b2909622f3c6d5a76addbcb70a94ef8f.zip
degesch: don't queue reconnects on bogus config
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;
}