$(srcdir)/validator/val_anchor.h $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h \
$(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_hints.h $(srcdir)/iterator/iter_delegpt.h \
$(srcdir)/services/outside_network.h $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/parseutil.h \
- $(srcdir)/sldns/wire2str.h
+ $(srcdir)/sldns/wire2str.h $(srcdir)/util/locks.h
stats.lo stats.o: $(srcdir)/daemon/stats.c config.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h \
$(srcdir)/libunbound/unbound.h $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h \
$(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
{
if(!ssl_printf(ssl, "start fast_reload\n"))
return;
- (void)worker;
+ fast_reload_thread_start(ssl, worker);
}
/** do the verbosity command */
clean_point(rc, s);
return 0;
}
+
+#ifndef THREADS_DISABLED
+/** fast reload thread. the thread main function */
+static void* fast_reload_thread_main(void* arg)
+{
+ struct fast_reload_thread* frio = (struct fast_reload_thread*)arg;
+ log_thread_set(&frio->threadnum);
+
+ verbose(VERB_ALGO, "start fast reload thread");
+
+ verbose(VERB_ALGO, "stop fast reload thread");
+ return NULL;
+}
+#endif /* !THREADS_DISABLED */
+
+/** fast reload thread. setup the thread info */
+static int
+fast_reload_thread_setup(struct worker* worker)
+{
+ int numworkers = worker->daemon->num;
+ worker->daemon->fast_reload_thread = (struct fast_reload_thread*)
+ calloc(1, sizeof(*worker->daemon->fast_reload_thread));
+ if(!worker->daemon->fast_reload_thread)
+ return 0;
+ /* The thread id printed in logs, numworker+1 is the dnstap thread.
+ * This is numworkers+2. */
+ worker->daemon->fast_reload_thread->threadnum = numworkers+2;
+ return 1;
+}
+
+/** fast reload thread. desetup and delete the thread info. */
+static void
+fast_reload_thread_desetup(struct fast_reload_thread* fast_reload_thread)
+{
+ if(!fast_reload_thread)
+ return;
+ free(fast_reload_thread);
+}
+
+void
+fast_reload_thread_start(RES* ssl, struct worker* worker)
+{
+ if(worker->daemon->fast_reload_thread) {
+ log_err("fast reload thread already running");
+ return;
+ }
+ if(!fast_reload_thread_setup(worker)) {
+ if(!ssl_printf(ssl, "error could not setup thread\n"))
+ return;
+ return;
+ }
+ worker->daemon->fast_reload_thread->started = 1;
+#ifndef THREADS_DISABLED
+ ub_thread_create(&worker->daemon->fast_reload_thread->tid,
+ fast_reload_thread_main, worker->daemon->fast_reload_thread);
+#else
+#endif
+}
+
+void
+fast_reload_thread_stop(struct fast_reload_thread* fast_reload_thread)
+{
+ if(!fast_reload_thread)
+ return;
+ fast_reload_thread_desetup(fast_reload_thread);
+}
#ifdef HAVE_OPENSSL_SSL_H
#include <openssl/ssl.h>
#endif
+#include "util/locks.h"
struct config_file;
struct listen_list;
struct listen_port;
};
typedef struct remote_stream RES;
+/**
+ * Fast reload thread structure
+ */
+struct fast_reload_thread {
+ /** the thread number for the dtio thread,
+ * must be first to cast thread arg to int* in checklock code. */
+ int threadnum;
+ /** event base, for event handling */
+ void* event_base;
+ /** thread id, of the io thread */
+ ub_thread_type tid;
+ /** if the io processing has started */
+ int started;
+};
+
/**
* Create new remote control state for the daemon.
* @param cfg: config file with key file settings.
int ssl_read_line(RES* ssl, char* buf, size_t max);
#endif /* HAVE_SSL */
+/**
+ * Start fast reload thread
+ * @param ssl: the RES connection to print to.
+ * @param worker: the remote servicing worker.
+ */
+void fast_reload_thread_start(RES* ssl, struct worker* worker);
+
+/**
+ * Stop fast reload thread
+ * @param fast_reload_thread: the thread struct.
+ */
+void fast_reload_thread_stop(struct fast_reload_thread* fast_reload_thread);
+
#endif /* DAEMON_REMOTE_H */