]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
This fix creates a more accurate way of detecting whether realtime members were deleted.
authorMark Michelson <mmichelson@digium.com>
Wed, 29 Aug 2007 15:52:42 +0000 (15:52 +0000)
committerMark Michelson <mmichelson@digium.com>
Wed, 29 Aug 2007 15:52:42 +0000 (15:52 +0000)
(closes issue 10541, reported by Alric, patched by me)

The REALLY nice things about this patch is that queue members now have a "realtime" field
which will be true if the member is a realtime member. This means we can check this value
prior to certain processing if it should ONLY be done for realtime members.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@81340 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_queue.c

index 56ab9fc73082f1c830e50712a99ef24549685799..7d0f3a3cd2aa5557f6570fe0724761820916c5e1 100644 (file)
@@ -318,6 +318,7 @@ struct member {
        int penalty;                        /*!< Are we a last resort? */
        int calls;                          /*!< Number of calls serviced by this member */
        int dynamic;                        /*!< Are we dynamically added? */
+       int realtime;                                           /*!< Is this member realtime? */
        int status;                         /*!< Status of queue member */
        int paused;                         /*!< Are we paused (not accepting calls)? */
        time_t lastcall;                    /*!< When last successful call was hungup */
@@ -954,6 +955,7 @@ static void rt_handle_member_record(struct call_queue *q, char *interface, const
        if (!m) {
                if ((m = create_queue_member(interface, membername, penalty, paused))) {
                        m->dead = 0;
+                       m->realtime = 1;
                        add_to_interfaces(interface);
                        if (prev_m) {
                                prev_m->next = m;
@@ -1081,10 +1083,10 @@ static struct call_queue *find_queue_by_name_rt(const char *queuename, struct as
        if (q->strategy == QUEUE_STRATEGY_ROUNDROBIN)
                rr_dep_warning();
 
-       /* Temporarily set non-dynamic members dead so we can detect deleted ones. 
+       /* Temporarily set realtime members dead so we can detect deleted ones. 
         * Also set the membercount correctly for realtime*/
        for (m = q->members; m; m = m->next, q->membercount++) {
-               if (!m->dynamic)
+               if (m->realtime)
                        m->dead = 1;
        }
 
@@ -1138,9 +1140,9 @@ static void update_realtime_members(struct call_queue *q)
 
        ast_mutex_lock(&q->lock);
        
-       /* Temporarily set non-dynamic members dead so we can detect deleted ones.*/ 
+       /* Temporarily set realtime  members dead so we can detect deleted ones.*/ 
        for (m = q->members; m; m = m->next) {
-               if (!m->dynamic)
+               if (m->realtime)
                        m->dead = 1;
        }
 
@@ -4026,6 +4028,8 @@ static int __queues_show(struct mansession *s, int manager, int fd, int argc, ch
                                        ast_build_string(&max, &max_left, " with penalty %d", mem->penalty);
                                if (mem->dynamic)
                                        ast_build_string(&max, &max_left, " (dynamic)");
+                               if (mem->realtime)
+                                       ast_build_string(&max, &max_left, " (realtime)");
                                if (mem->paused)
                                        ast_build_string(&max, &max_left, " (paused)");
                                ast_build_string(&max, &max_left, " (%s)", devstate2str(mem->status));