]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix a problem in ChanSpy where it could get stuck in an infinite loop without
authorRussell Bryant <russell@russellbryant.com>
Wed, 27 Feb 2008 17:33:04 +0000 (17:33 +0000)
committerRussell Bryant <russell@russellbryant.com>
Wed, 27 Feb 2008 17:33:04 +0000 (17:33 +0000)
being able to detect that the calling channel hung up.
(closes issue #12076, reported by junky, patched by me)

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

apps/app_chanspy.c

index 297bbec97c5d56828200f426a79744d42923dc56..e25389520edbfdbc2e52a98216069c3c0b4f16ba 100644 (file)
@@ -538,6 +538,12 @@ static int common_exec(struct ast_channel *chan, const struct ast_flags *flags,
                                break;
                        }
 
+                       if (ast_check_hangup(chan)) {
+                               ast_channel_unlock(peer);
+                               chanspy_ds_free(peer_chanspy_ds);
+                               break;
+                       }
+
                        if (peer == chan) {
                                ast_channel_unlock(peer);
                                continue;
@@ -633,7 +639,7 @@ static int common_exec(struct ast_channel *chan, const struct ast_flags *flags,
                                peer = NULL;
                        }
                }
-               if (res == -1)
+               if (res == -1 || ast_check_hangup(chan))
                        break;
        }