Fix a bug in peer handling that caused multiple instances of a peer to end up
authorRussell Bryant <russell@russellbryant.com>
Wed, 26 Dec 2007 16:51:16 +0000 (16:51 +0000)
committerRussell Bryant <russell@russellbryant.com>
Wed, 26 Dec 2007 16:51:16 +0000 (16:51 +0000)
in the peers container after a reload.  Somehow, this bug doesn't exist in 1.4 ...
(closes issue #11626)
(reported by pnlarsson, additional info from mvanbaak, fixed by me)

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

channels/chan_iax2.c

index b424c60..3aebc4f 100644 (file)
@@ -6454,7 +6454,7 @@ static void unlink_peer(struct iax2_peer *peer)
                }
        }
 
-       unlink_peer(peer);
+       ao2_unlink(peers, peer);
 }
 
 static void __expire_registry(const void *data)
@@ -9872,6 +9872,7 @@ static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, st
                        oldha = peer->ha;
                        peer->ha = NULL;
                }
+               unlink_peer(peer);
        } else if ((peer = ao2_alloc(sizeof(*peer), peer_destructor))) {
                peer->expire = -1;
                peer->pokeexpire = -1;