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

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


Author: kpfleming
Date: Tue Jan  6 18:55:27 2009
New Revision: 167371

URL: http://svn.digium.com/view/asterisk?view=rev&rev=167371
Log:
simplify a bit... no need for an extra structure type

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=167371&r1=167370&r2=167371
==============================================================================
--- 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:55:27 2009
@@ -629,13 +629,7 @@
 	char data[SIP_MAX_PACKET];
 	unsigned int sdp_start; /*!< the line number where the SDP begins */
 	unsigned int sdp_end;   /*!< the line number where the SDP ends */
-};
-
-struct request_queue_entry {
-	struct sip_request request;
-	/* this is not really necessary, it's in sip_pvt->recv */
-	struct sockaddr_in sin;
-	AST_LIST_ENTRY(request_queue_entry) next;
+	AST_LIST_ENTRY(sip_request) next;
 };
 
 /*
@@ -1029,7 +1023,7 @@
 	struct sip_history_head *history;	/*!< History of this SIP dialog */
 	size_t history_entries;			/*!< Number of entires in the history */
 	struct ast_variable *chanvars;		/*!< Channel variables to set for inbound call */
-	AST_LIST_HEAD_NOLOCK(request_queue, request_queue_entry) request_queue;
+	AST_LIST_HEAD_NOLOCK(request_queue, sip_request) request_queue;
 	int request_queue_sched_id;
 	struct sip_pvt *next;			/*!< Next dialog in chain */
 	struct sip_invite_param *options;	/*!< Options for INVITE */
@@ -3109,7 +3103,7 @@
 {
 	struct sip_pvt *cur, *prev = NULL;
 	struct sip_pkt *cp;
-	struct request_queue_entry *rqe;
+	struct sip_request *req;
 
 	/* 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)) {
@@ -3198,8 +3192,8 @@
 		p->history = NULL;
 	}
 
-	while ((rqe = AST_LIST_REMOVE_HEAD(&p->request_queue, next))) {
-		ast_free(rqe);
+	while ((req = AST_LIST_REMOVE_HEAD(&p->request_queue, next))) {
+		ast_free(req);
 	}
 
 	for (prev = NULL, cur = iflist; cur; prev = cur, cur = cur->next) {
@@ -15938,16 +15932,16 @@
 
 static void process_request_queue(struct sip_pvt *p, int *recount, int *nounlock)
 {
-	struct request_queue_entry *rqe;
+	struct sip_request *req;
 	
-	while ((rqe = AST_LIST_REMOVE_HEAD(&p->request_queue, next))) {
-		if (handle_request(p, &rqe->request, &rqe->sin, recount, nounlock) == -1) {
+	while ((req = AST_LIST_REMOVE_HEAD(&p->request_queue, next))) {
+		if (handle_request(p, req, &p->recv, recount, nounlock) == -1) {
 			/* Request failed */
 			if (option_debug) {
 				ast_log(LOG_DEBUG, "SIP message could not be handled, bad request: %-70.70s\n", p->callid[0] ? p->callid : "<no callid>");
 			}
 		}
-		ast_free(rqe);
+		ast_free(req);
 	}
 }
 
@@ -16003,15 +15997,14 @@
 
 static int queue_request(struct sip_pvt *p, const struct sip_request *req, const struct sockaddr_in *sin)
 {
-	struct request_queue_entry *rqe;
-
-	if (!(rqe = ast_calloc(1, sizeof(*rqe)))) {
+	struct sip_request *newreq;
+
+	if (!(newreq = ast_calloc(1, sizeof(*newreq)))) {
 		return -1;
 	}
 
-	copy_request(&rqe->request, req);
-	rqe->sin = *sin;
-	AST_LIST_INSERT_TAIL(&p->request_queue, rqe, next);
+	copy_request(newreq, req);
+	AST_LIST_INSERT_TAIL(&p->request_queue, newreq, next);
 	if (p->request_queue_sched_id == -1) {
 		p->request_queue_sched_id = ast_sched_add(sched, 10, scheduler_process_request_queue, p);
 	}




More information about the asterisk-commits mailing list