]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add "detached" status to async && worker
authorAlan T. DeKok <aland@freeradius.org>
Mon, 11 Sep 2017 18:50:10 +0000 (14:50 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 11 Sep 2017 18:50:10 +0000 (14:50 -0400)
so that the worker can run detached fake requests, and not send
actual replies

src/lib/io/listen.h
src/lib/io/worker.c

index 49f1572da88f3dc2eaf6a596c12e93d86abc0ba6..1d38d5117315b5a550c8fccbd72620968a867f32 100644 (file)
@@ -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
index 1f611b12f5be14210ca88b7977ca3dd535c8c303..b7c0d6f44aec63f86a6a51af1bc7fecfbedd435a 100644 (file)
@@ -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.
         */