]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
unify public and internal signals
authorAlan T. DeKok <aland@freeradius.org>
Sun, 11 Dec 2016 02:39:40 +0000 (21:39 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 11 Dec 2016 02:41:15 +0000 (21:41 -0500)
src/util/channel.c
src/util/channel.h

index 68074f531757a7d01c572d2c3f8142a237013b30..49f37384d48dcb05378a01e614742861610aac13 100644 (file)
@@ -75,13 +75,18 @@ RCSID("$Id$")
 #define ATOMIC_QUEUE_SIZE (1024)
 
 typedef enum fr_channel_signal_t {
-       FR_CHANNEL_SIGNAL_FAIL = 0,
-       FR_CHANNEL_SIGNAL_DATA_TO_WORKER,
-       FR_CHANNEL_SIGNAL_DATA_FROM_WORKER,
+       FR_CHANNEL_SIGNAL_ERROR                 = FR_CHANNEL_ERROR,
+       FR_CHANNEL_SIGNAL_DATA_TO_WORKER        = FR_CHANNEL_DATA_READY_WORKER,
+       FR_CHANNEL_SIGNAL_DATA_FROM_WORKER      = FR_CHANNEL_DATA_READY_RECEIVER,
+       FR_CHANNEL_SIGNAL_OPEN                  = FR_CHANNEL_OPEN,
+       FR_CHANNEL_SIGNAL_CLOSE                 = FR_CHANNEL_CLOSE,
+
+       /*
+        *      The preceding MUST be in the same order as fr_channel_event_t
+        */
+
        FR_CHANNEL_SIGNAL_DATA_DONE_WORKER,
        FR_CHANNEL_SIGNAL_WORKER_SLEEPING,
-       FR_CHANNEL_SIGNAL_OPEN,
-       FR_CHANNEL_SIGNAL_CLOSE,
 } fr_channel_signal_t;
 
 typedef struct fr_channel_control_t {
@@ -597,33 +602,17 @@ static fr_channel_event_t fr_channel_service_aq(fr_atomic_queue_t *aq, fr_time_t
        talloc_free(cc);
 
        switch (cs) {
-       case FR_CHANNEL_SIGNAL_FAIL:
-               return FR_CHANNEL_ERROR;
-
                /*
-                *      Data is ready on one or both channels.  Non-zero
-                *      idents are just signals that data is ready.  We just
-                *      return the channel to the caller, and rely on it to
-                *      service the channel.
+                *      These all have the same numbers as the channel
+                *      events, and have no extra processing.  We just
+                *      return them as-is.
                 */
-       case FR_CHANNEL_SIGNAL_DATA_FROM_WORKER:
-               return FR_CHANNEL_DATA_READY_RECEIVER;
-
+       case FR_CHANNEL_SIGNAL_ERROR:
        case FR_CHANNEL_SIGNAL_DATA_TO_WORKER:
-               return FR_CHANNEL_DATA_READY_WORKER;
-
-               /*
-                *      Someone is sending us a new channel.  We MUST be the
-                *      worker.  Return the channel to the worker.
-                */
+       case FR_CHANNEL_SIGNAL_DATA_FROM_WORKER:
        case FR_CHANNEL_SIGNAL_OPEN:
-               return FR_CHANNEL_OPEN;
-
-               /*
-                *      Each end can signal the channel to close.
-                */
        case FR_CHANNEL_SIGNAL_CLOSE:
-               return FR_CHANNEL_CLOSE;
+               return (fr_channel_event_t) cs;
 
                /*
                 *      Only sent by the worker.  Both of these
index 55a06cce41665915eb78757516de408368dec709..4e36e76a8cbd54750c62040fdbc4278ff5ad7b20 100644 (file)
@@ -46,11 +46,12 @@ typedef struct fr_channel_t fr_channel_t;
 
 typedef enum fr_channel_event_t {
        FR_CHANNEL_ERROR = 0,
-       FR_CHANNEL_NOOP,
        FR_CHANNEL_DATA_READY_WORKER,
        FR_CHANNEL_DATA_READY_RECEIVER,
        FR_CHANNEL_OPEN,
        FR_CHANNEL_CLOSE,
+
+       FR_CHANNEL_NOOP,
        FR_CHANNEL_EMPTY,
 } fr_channel_event_t;