1 diff --git a/src/afinter.c b/src/afinter.c
2 index 0085d85..a67a9a7 100644
5 @@ -34,6 +34,7 @@ typedef struct _AFInterSourceDriver
8 static gint next_mark_target = -1;
9 +static GSource *global_internal_source;
12 afinter_postpone_mark(gint mark_freq)
13 @@ -121,6 +122,7 @@ afinter_source_dispatch(GSource *source,
15 afinter_source_finalize(GSource *source)
17 + global_internal_source = NULL;
20 GSourceFuncs afinter_source_watch_funcs =
21 @@ -161,11 +163,26 @@ afinter_source_init(LogPipe *s)
23 if (!log_source_init(s))
26 + if (cfg->internal_source_present)
28 + msg_error("You have two internal() sources in your configuration, this is not supported and would cause hangs", NULL);
32 + if (global_internal_source)
34 + msg_error("Internal error, internal() GSource was duplicated, this is bad", NULL);
35 + g_assert_not_reached();
39 /* the source added below references this logreader, it will be unref'd
40 when the source is destroyed */
41 self->watch = afinter_source_watch_new(&self->super.super, cfg->mark_freq);
42 g_source_attach(self->watch, NULL);
43 + global_internal_source = self->watch;
44 + cfg->internal_source_present = TRUE;
48 @@ -204,8 +221,13 @@ afinter_sd_init(LogPipe *s)
50 log_source_options_init(&self->source_options, cfg, self->super.group);
51 self->source = afinter_source_new(self, &self->source_options);
52 + if (!log_pipe_init(&self->source->super, cfg))
54 + log_pipe_unref(&self->source->super);
55 + self->source = NULL;
58 log_pipe_append(&self->source->super, s);
59 - log_pipe_init(&self->source->super, cfg);
63 diff --git a/src/cfg.h b/src/cfg.h
64 index 5e3f1bd..cc2005d 100644
67 @@ -98,6 +98,7 @@ struct _GlobalConfig
69 struct _LogTemplate *file_template;
70 struct _LogTemplate *proto_template;
71 + gboolean internal_source_present;