]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
if no worker and the dir changed, start checking again
authorAlan T. DeKok <aland@freeradius.org>
Wed, 15 Nov 2017 18:18:12 +0000 (13:18 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 15 Nov 2017 18:18:12 +0000 (13:18 -0500)
src/modules/proto_detail/proto_detail_file.c

index a2bf8d208ff77bac8f97e47281311cba41b5ceb9..5c06a57315b30ddc31f5bf7e32212aab7309e10f 100644 (file)
@@ -94,14 +94,18 @@ static ssize_t mod_write(void *instance, void *packet_ctx,
 static void mod_vnode_extend(void *instance, UNUSED uint32_t fflags)
 {
        proto_detail_file_t *inst = talloc_get_type_abort(instance, proto_detail_file_t);
+       bool has_worker = false;
 
-       DEBUG("Directory %s changed", inst->directory);
 
-       /*
-        *      @todo - troll for detail.work file.  Allocate new
-        *      proto_detail_work_t, fill it in, and start up the new
-        *      detail worker.
-        */
+       PTHREAD_MUTEX_LOCK(&inst->parent->worker_mutex);
+       has_worker = (inst->parent->num_workers == 0);
+       PTHREAD_MUTEX_UNLOCK(&inst->parent->worker_mutex);
+
+       if (has_worker) return;
+
+       if (inst->ev) fr_event_timer_delete(inst->el, &inst->ev);
+
+       work_init(inst);
 }
 
 /** Open a detail listener