From: Arran Cudbard-Bell Date: Thu, 12 Dec 2019 12:18:41 +0000 (+0700) Subject: Make trunk more permissive regarding what callbacks need to be provided X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ee33e2345022074bf58a27f56ff6c67192d0b44;p=thirdparty%2Ffreeradius-server.git Make trunk more permissive regarding what callbacks need to be provided --- diff --git a/src/lib/server/trunk.c b/src/lib/server/trunk.c index 24b6fe9eac8..27fa9d1ad77 100644 --- a/src/lib/server/trunk.c +++ b/src/lib/server/trunk.c @@ -3328,7 +3328,11 @@ static void trunk_backlog_drain(fr_trunk_t *trunk) if (fr_heap_num_elements(trunk->backlog) == 0) return; - DEBUG2("Draining backlog of requests"); + /* + * If it's always writable, this isn't + * really a noteworthy event. + */ + if (!trunk->conf.always_writable) DEBUG4("Draining backlog of requests"); /* * Do *NOT* add an artificial limit @@ -3544,22 +3548,20 @@ fr_trunk_t *fr_trunk_alloc(TALLOC_CTX *ctx, fr_event_list_t *el, /* * Check we have the functions we need */ - if (!fr_cond_assert(funcs->request_prioritise)) return NULL; if (!fr_cond_assert(funcs->connection_alloc)) return NULL; -#ifndef TESTING_TRUNK - if (!fr_cond_assert(funcs->request_mux)) return NULL; - if (!fr_cond_assert(funcs->request_demux)) return NULL; -#endif - MEM(trunk = talloc_zero(ctx, fr_trunk_t)); trunk->el = el; trunk->log_prefix = talloc_strdup(trunk, log_prefix); - memcpy(&trunk->conf, conf, sizeof(trunk->conf)); + memcpy(&trunk->funcs, funcs, sizeof(trunk->funcs)); if (!trunk->funcs.connection_prioritise) { trunk->funcs.connection_prioritise = _trunk_connection_order_by_shortest_queue; } + if (!trunk->funcs.request_prioritise) trunk->funcs.request_prioritise = fr_pointer_cmp; + + memcpy(&trunk->conf, conf, sizeof(trunk->conf)); + memcpy(&trunk->uctx, &uctx, sizeof(trunk->uctx)); talloc_set_destructor(trunk, _trunk_free); diff --git a/src/lib/server/trunk.h b/src/lib/server/trunk.h index 066d9c98d11..344085a6459 100644 --- a/src/lib/server/trunk.h +++ b/src/lib/server/trunk.h @@ -1,3 +1,4 @@ +#pragma once /* * This program is is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by