[Asterisk-code-review] Message.c: Clear message channel frames on cleanup (asterisk[13])

Jonathan Rose asteriskteam at digium.com
Wed May 13 16:09:02 CDT 2015


Jonathan Rose has uploaded a new change for review.

  https://gerrit.asterisk.org/466

Change subject: Message.c: Clear message channel frames on cleanup
......................................................................

Message.c: Clear message channel frames on cleanup

The message channel is special channel that doesn't actually process frames.
However, certain actions can cause frames to be placed in channel's read
queue including the Hangup application which is called on the channel after
each message is processed. Since the channel will continually be reused for
many messages, it's necessary to flush these frames at some point.

ASTERISK-25083 #close
Reported by: Jonathan Rose

Change-Id: Idf18df73ccd8c220be38743335b5c79c2a4c0d0f
---
M main/message.c
1 file changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/66/466/1

diff --git a/main/message.c b/main/message.c
index 581487f..b9602d3 100644
--- a/main/message.c
+++ b/main/message.c
@@ -743,6 +743,7 @@
 	struct ast_datastore *msg_ds, *ds;
 	struct varshead *headp;
 	struct ast_var_t *vardata;
+	struct ast_frame *cur;
 
 	ast_channel_lock(chan);
 
@@ -772,6 +773,15 @@
 	}
 
 	/*
+	 * Remove frames from read queue
+	 */
+	AST_LIST_TRAVERSE_SAFE_BEGIN(ast_channel_readq(chan), cur, frame_list) {
+		AST_LIST_REMOVE_CURRENT(frame_list);
+		ast_frfree(cur);
+	}
+	AST_LIST_TRAVERSE_SAFE_END;
+
+	/*
 	 * Restore msg datastore.
 	 */
 	if (msg_ds) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idf18df73ccd8c220be38743335b5c79c2a4c0d0f
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Jonathan Rose <jrose at digium.com>



More information about the asterisk-code-review mailing list