[asterisk-commits] kpfleming: branch sruffell/asterisk-1.4-transcoder r167369 - /team/sruffell/a...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 6 18:31:32 CST 2009


Author: kpfleming
Date: Tue Jan  6 18:31:31 2009
New Revision: 167369

URL: http://svn.digium.com/view/asterisk?view=rev&rev=167369
Log:
allocate the proper amount of memory to queue a request

free any queued requests when a sip_pvt is destroyed

don't reschedule a queue processing run if there are no queued requests


Modified:
    team/sruffell/asterisk-1.4-transcoder/channels/chan_sip.c

Modified: team/sruffell/asterisk-1.4-transcoder/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/sruffell/asterisk-1.4-transcoder/channels/chan_sip.c?view=diff&rev=167369&r1=167368&r2=167369
==============================================================================
--- team/sruffell/asterisk-1.4-transcoder/channels/chan_sip.c (original)
+++ team/sruffell/asterisk-1.4-transcoder/channels/chan_sip.c Tue Jan  6 18:31:31 2009
@@ -3109,6 +3109,7 @@
 {
 	struct sip_pvt *cur, *prev = NULL;
 	struct sip_pkt *cp;
+	struct request_queue_entry *rqe;
 
 	/* We absolutely cannot destroy the rtp struct while a bridge is active or we WILL crash */
 	if (p->rtp && ast_rtp_get_bridged(p->rtp)) {
@@ -3195,6 +3196,10 @@
 		}
 		free(p->history);
 		p->history = NULL;
+	}
+
+	while ((rqe = AST_LIST_REMOVE_HEAD(&p->request_queue, next))) {
+		ast_free(rqe);
 	}
 
 	for (prev = NULL, cur = iflist; cur; prev = cur, cur = cur->next) {
@@ -15970,12 +15975,15 @@
 	}
 
 	if (!lockretry) {
+		int retry = !AST_LIST_EMPTY(&p->request_queue);
+
 		/* we couldn't get the owner lock, which is needed to process
 		   the queued requests, so return a non-zero value, which will
-		   cause the scheduler to run this request again later
+		   cause the scheduler to run this request again later if there
+		   still requests to be processed
 		*/
 		ast_mutex_unlock(&p->lock);
-		return 1;
+		return retry;
 	};
 
 	process_request_queue(p, &recount, &nounlock);
@@ -15997,7 +16005,7 @@
 {
 	struct request_queue_entry *rqe;
 
-	if (!(rqe = ast_calloc(1, sizeof(*req)))) {
+	if (!(rqe = ast_calloc(1, sizeof(*rqe)))) {
 		return -1;
 	}
 




More information about the asterisk-commits mailing list