[asterisk-commits] mvanbaak: branch group/multiparking r105114 - /team/group/multiparking/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 28 16:15:27 CST 2008


Author: mvanbaak
Date: Thu Feb 28 16:15:27 2008
New Revision: 105114

URL: http://svn.digium.com/view/asterisk?view=rev&rev=105114
Log:
following putnopvut's tutorial on irc

Modified:
    team/group/multiparking/main/features.c

Modified: team/group/multiparking/main/features.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/main/features.c?view=diff&rev=105114&r1=105113&r2=105114
==============================================================================
--- team/group/multiparking/main/features.c (original)
+++ team/group/multiparking/main/features.c Thu Feb 28 16:15:27 2008
@@ -2269,7 +2269,7 @@
 	ASTOBJ_WRLOCK(curlot);
 	/* Lock parking list */
 	AST_LIST_LOCK(&curlot->parkings);
-	AST_LIST_TRAVERSE(&curlot->parkings, pu, list) {
+	AST_LIST_TRAVERSE_SAFE_BEGIN(&curlot->parkings, pu, list) {
 
 //SKREP - needs AST LIST TRAVERSAL STUFF!
 //	pu = curlot->occupiedlots;
@@ -2279,8 +2279,8 @@
 		struct ast_context *con;
 
 		if (pu->notquiteyet) { /* Pretend this one isn't here yet */
-			pl = pu;
-			pu = pu->parkfindnext;
+			//pl = pu;
+			//pu = pu->parkfindnext;
 			continue;
 		}
 		tms = ast_tvdiff_ms(ast_tvnow(), pu->start);
@@ -2340,10 +2340,10 @@
 				ast_hangup(chan);
 			}
 			/* And take them out of the parking lot */
-			if (pl) 
-				pl->next = pu->next;
-			else
-				curlot->occupiedlots = pu->next;
+			//if (pl) 
+			//	pl->next = pu->next;
+			//else
+			//	curlot->occupiedlots = pu->next;
 			pt = pu;
 			pu = pu->next;
 			con = ast_context_find(pt->parkinglot->parking_con);
@@ -2381,21 +2381,22 @@
 					ast_verb(2, "%s got tired of being parked\n", chan->name);
 					ast_hangup(chan);
 					/* And take them out of the parking lot */
-					if (pl) 
-						pl->next = pu->next;
-					else
-						curlot->occupiedlots = pu->next;
-					pt = pu;
-					pu = pu->next;
+					//if (pl) 
+					//	pl->next = pu->next;
+					//else
+					//	curlot->occupiedlots = pu->next;
+					//pt = pu;
+					//pu = pu->next;
 					con = ast_context_find(curlot->parking_con);
 					if (con) {
-						if (ast_context_remove_extension2(con, pt->parkingexten, 1, NULL))
+						if (ast_context_remove_extension2(con, pu->parkingexten, 1, NULL))
 							ast_log(LOG_WARNING, "Whoa, failed to remove the extension!\n");
 						else
 							notify_metermaids(pu->parkingexten, curlot->parking_con, AST_DEVICE_NOT_INUSE);
 					} else
 						ast_log(LOG_WARNING, "Whoa, no parking context for parking lot %s?\n", curlot->name);
-					free(pt);
+					//free(pt);
+					AST_LIST_REMOVE_CURRENT(&curlot->parkings, list);
 					parkinglot_unref(curlot);
 					break;
 				} else {
@@ -2423,11 +2424,12 @@
 				/* Keep track of our shortest wait */
 				if (tms < ms || ms < 0)
 					ms = tms;
-				pl = pu;
-				pu = pu->next;
+				//pl = pu;
+				//pu = pu->next;
 			}
 		}
 	}
+	AST_LIST_TRAVERSE_SAFE_END();
 	AST_LIST_UNLOCK(&curlot->parkings);
 
 	ASTOBJ_UNLOCK(curlot);




More information about the asterisk-commits mailing list