]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
use switch statement
authorAlan T. DeKok <aland@freeradius.org>
Mon, 5 Dec 2016 16:04:47 +0000 (11:04 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 5 Dec 2016 16:10:48 +0000 (11:10 -0500)
src/util/channel.c

index 38a4872fa7bebe04245d829c39585ad7ed983d62..85b18cfb6d1a1b38fafd53e0ef11fd93d3835be8 100644 (file)
@@ -528,41 +528,40 @@ fr_channel_event_t fr_channel_service_kevent(int kq, struct kevent const *kev, f
        talloc_get_type_abort(ch, fr_channel_t);
 #endif
 
-       /*
-        *      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.
-        */
-       if (kev->ident == FR_CHANNEL_SIGNAL_DATA_FROM_WORKER) {
+       switch (kev->ident) {
+               /*
+                *      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.
+                */
+       case FR_CHANNEL_SIGNAL_DATA_FROM_WORKER:
                *p_channel = ch;
                return FR_CHANNEL_DATA_READY_RECEIVER;
-       }
 
-       if (kev->ident == FR_CHANNEL_SIGNAL_DATA_TO_WORKER) {
+       case FR_CHANNEL_SIGNAL_DATA_TO_WORKER:
                *p_channel = ch;
                return FR_CHANNEL_DATA_READY_WORKER;
-       }
 
-       /*
-        *      Someone is sending us a new channel.  We MUST be the
-        *      worker.  Return the channel to the worker.
-        */
-       if (kev->ident == FR_CHANNEL_SIGNAL_OPEN) {
+               /*
+                *      Someone is sending us a new channel.  We MUST be the
+                *      worker.  Return the channel to the worker.
+                */
+       case FR_CHANNEL_SIGNAL_OPEN:
                rad_assert(kq == ch->end[TO_WORKER].kq);
 
                *p_channel = ch;
                return FR_CHANNEL_OPEN;
-       }
-
-       /*
-        *      Each end can signal the channel to close.
-        */
-       if (kev->ident == FR_CHANNEL_SIGNAL_CLOSE) {
-//             rad_assert(kq == ch->end[kev->data].kq);
 
+               /*
+                *      Each end can signal the channel to close.
+                */
+       case FR_CHANNEL_SIGNAL_CLOSE:
                *p_channel = ch;
                return FR_CHANNEL_CLOSE;
+
+       case FR_CHANNEL_SIGNAL_WORKER_SLEEPING:
+               break;
        }
 
        rad_assert(kev->ident == FR_CHANNEL_SIGNAL_WORKER_SLEEPING);