[Asterisk-code-review] app chanspy: Fix occasional deadlock with ChanSpy and Local ... (asterisk[11])

Richard Mudgett asteriskteam at digium.com
Fri Mar 11 14:24:46 CST 2016


Richard Mudgett has posted comments on this change.

Change subject: app_chanspy: Fix occasional deadlock with ChanSpy and Local channels.
......................................................................


Patch Set 2: Code-Review-1

(1 comment)

https://gerrit.asterisk.org/#/c/2374/2/include/asterisk/autochan.h
File include/asterisk/autochan.h:

Line 69: 	do { \
       : 		struct ast_channel *autochan_chan = autochan->chan; \
       : 		ast_channel_lock(autochan_chan); \
       : 		if (autochan->chan != autochan_chan) { \
       : 			ast_channel_unlock(autochan_chan); \
       : 			continue; \
       : 		} \
       : 	} while(0)
This loop isn't going to do what you think.  When you use continue it goes to the test which will always exit the loop.  In this case continue and break are the same thing.

Suggest:

do {
  struct ast_channel *autochan_chan = autochan->chan;
  ast_channel_lock(autochan_chan);
  if (autochan->chan == autochan_chan) {
    break;
  }
  ast_channel_unlock(autochan_chan);
} while (1)


-- 
To view, visit https://gerrit.asterisk.org/2374
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I293ae0014e531cd0e675c3f02d1d118a98683def
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: Walter Doekes <walter+asterisk at wjd.nu>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Walter Doekes <walter+asterisk at wjd.nu>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list