]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add comments explaining functional requirements
authorAlan T. DeKok <aland@freeradius.org>
Wed, 14 Dec 2016 20:43:03 +0000 (15:43 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 14 Dec 2016 20:43:03 +0000 (15:43 -0500)
src/util/worker.c

index 1703eec1d511d3ac77c3f5291b8c0c10e537499f..4dbfb661cfb281fb1e19fd78c473f74fecaa3f6a 100644 (file)
@@ -174,13 +174,15 @@ static void fr_worker_evfilt_user(UNUSED int kq, UNUSED struct kevent const *kev
 }
 
 /** Decode a request from either the localized queue, or the to_decode queue
+ *
+ *  The request returned from this function MUST be immediately runnable.
  *
  * @param[in] worker the worker
  * @return
  *     - NULL on nothing to decode
  *     - REQUEST the decoded request
  */
-static REQUEST *fr_worker_decode_request(fr_worker_t *worker)
+static REQUEST *fr_worker_decode_request(fr_worker_t *worker, fr_time_t now)
 {
        int rcode;
        fr_channel_data_t *cd;
@@ -258,6 +260,7 @@ static REQUEST *fr_worker_decode_request(fr_worker_t *worker)
         *      transitions.
         */
        request->process_async = request->transport->process;
+       fr_time_tracking_start(&request->tracking, now);
 
        return request;
 }
@@ -388,13 +391,7 @@ static REQUEST *fr_worker_get_request(fr_worker_t *worker, fr_time_t now)
        /*
         *      Grab a request to decode, and start it.
         */
-       request = fr_worker_decode_request(worker);
-       if (request) {
-               fr_time_tracking_start(&request->tracking, now);
-               return request;
-       }
-
-       return NULL;
+       return fr_worker_decode_request(worker, now);
 }
 
 
@@ -484,6 +481,10 @@ static void fr_worker_run_request(fr_worker_t *worker, REQUEST *request)
 }
 
 /** Run the event loop 'idle' callback
+ *
+ *  This function MUST DO NO WORK.  All it does is check if there's
+ *  work, and tell the event code to return to the main loop if
+ *  there's work to do.
  *
  * @param[in] ctx the worker
  * @param[in] wake the time when the event loop will wake up.