From: Alan T. DeKok Date: Mon, 11 Sep 2017 18:50:10 +0000 (-0400) Subject: add "detached" status to async && worker X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=643dbfec1c38f0ef03dbc5be5294f4d9ec771ce4;p=thirdparty%2Ffreeradius-server.git add "detached" status to async && worker so that the worker can run detached fake requests, and not send actual replies --- diff --git a/src/lib/io/listen.h b/src/lib/io/listen.h index 49f1572da88..1d38d511731 100644 --- a/src/lib/io/listen.h +++ b/src/lib/io/listen.h @@ -49,10 +49,11 @@ struct fr_async_t { fr_time_tracking_t tracking; fr_channel_t *channel; - uint32_t priority; void *packet_ctx; fr_listen_t const *listen; //!< How we received this request, //!< and how we'll send the reply. + uint32_t priority; + bool detached; //!< if detached, we don't send real replies }; /** Information to track src/dst ip/port diff --git a/src/lib/io/worker.c b/src/lib/io/worker.c index 1f611b12f5b..b7c0d6f44ae 100644 --- a/src/lib/io/worker.c +++ b/src/lib/io/worker.c @@ -443,6 +443,17 @@ static void fr_worker_send_reply(fr_worker_t *worker, REQUEST *request, size_t s fr_channel_t *ch; fr_message_set_t *ms; + /* + * If it's a detached request, don't send a real reply. + * Just toss the request. + */ + if (request->async->detached) { + fr_time_tracking_end(&request->async->tracking, fr_time(), &worker->tracking); + RDEBUG("finished request."); + talloc_free(request); + return; + } + /* * Allocate and send the reply. */