[asterisk-bugs] [JIRA] (ASTERISK-24500) Regression introduced in chan_mgcp by SVN revision r227276

Xavier Hienne (JIRA) noreply at issues.asterisk.org
Wed Nov 5 10:46:29 CST 2014


Xavier Hienne created ASTERISK-24500:
----------------------------------------

             Summary: Regression introduced in chan_mgcp by SVN revision r227276
                 Key: ASTERISK-24500
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-24500
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Channels/chan_mgcp
    Affects Versions: 13.0.0, 12.6.1, SVN, 1.8.32.0, 11.14.0
            Reporter: Xavier Hienne


In SVN revision r227276, a while() loop was turned into a for() loop.

{code}
@@ -1804,14 +1737,12 @@
        if (at && (at[0] == '[')) {
                at++;
                c = strrchr(at, ']');
-               if (c)
+               if (c) {
                        *c = '\0';
+               }
        }
-       g = gateways;
-       if(!g)
-               g = find_realtime_gw(name, at, sin);
-       while(g) {
-               if ((!name || !strcasecmp(g->name, at)) && 
+       for (g = gateways ? gateways : find_realtime_gw(name, at, sin); g; g = g->next ? g->next : find_realtime_gw(name, at, sin)) {
+               if ((!name || !strcasecmp(g->name, at)) &&
{code}

Following this, parts of the code like the chunk below were removed since it's now done in the for() line:
{code}
@@ -1841,48 +1770,21 @@
                                        continue;
                                }
                        } else {
-                               if(!g->next)
-                                       g = find_realtime_gw(name, at, sin);
-                               else
-                                       g = g->next;
                                continue;
                        }
{code}

The problem is that one such code chunk was forgotten and is still here in the "else if (!name && sin)" block, duplicating what is already done in the for() line.

The end result is that instead of going through the linked list of MGCP gateways one by one, when a static unnamed MGCP GW is encountered in the list, the next GW is skipped.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list