[Home]

Summary:ASTERISK-10382: [patch] app_queue: interface_exists_global not set return value...
Reporter:Alexandre Snarskii (snar)Labels:
Date Opened:2007-09-24 10:16:29Date Closed:2007-09-24 13:46:07
Priority:TrivialRegression?No
Status:Closed/CompleteComponents:Applications/app_queue
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) app-queue-interface-exists.patch
Description:
Function interface_exists_global traverses all queues in order to find,
is the given interface exists in any of the queues...
return value, ret, initialized as ret=0 at line 876, then we gone into
cycle, and, if we found matching interface
               if ((mem = ao2_find(q->members, &tmpmem, OBJ_POINTER))) {
                       ao2_ref(mem, -1);
                       ao2_unlock(q);
                       queue_unref(q);
                       break;
               }                
we do not change ret before return...
So, interface is never found by the function.
Comments:By: Digium Subversion (svnbot) 2007-09-24 11:42:02

Repository: asterisk
Revision: 83656

------------------------------------------------------------------------
r83656 | mmichelson | 2007-09-24 11:42:01 -0500 (Mon, 24 Sep 2007) | 5 lines

interface_exists_global was never returning 1. Most likely an error from my merge on Friday.

(closes issue ASTERISK-10382, reported and patched by snar, patch simplified by me)


------------------------------------------------------------------------

By: Alexandre Snarskii (snar) 2007-09-24 12:21:10

Looks like you oversimplified my patch :)

Proposed patch returned 1 right after interface was detected, but in your version
you still scanning other queues looking for other instances of the same interface,
however will you found it or not - it will not change return value.

By: Mark Michelson (mmichelson) 2007-09-24 13:23:03

Have you actually tested my version of the patch?

Recall that "break" breaks out of the while loop, not the if block. Your version of the patch has a line which can never execute since the evaluation of ret will never be true.

By: Mark Michelson (mmichelson) 2007-09-24 13:46:06

Your note made me start doubting myself, so I set up some tests to be certain that I did not oversimplify your patch. After running the tests, I can say with confidence that everything is working as it should. I appreciate your concern, though.

Closing...