[svn-commits] jpeeler: branch group/multiparking r114130 - /team/group/multiparking/main/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Mon Apr 14 15:25:14 CDT 2008
Author: jpeeler
Date: Mon Apr 14 15:25:14 2008
New Revision: 114130
URL: http://svn.digium.com/view/asterisk?view=rev&rev=114130
Log:
checkpoint, fixes producing multiple parkinglots on reload, but modifying pbx.c should not be required
Modified:
team/group/multiparking/main/features.c
team/group/multiparking/main/pbx.c
Modified: team/group/multiparking/main/features.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/main/features.c?view=diff&rev=114130&r1=114129&r2=114130
==============================================================================
--- team/group/multiparking/main/features.c (original)
+++ team/group/multiparking/main/features.c Mon Apr 14 15:25:14 2008
@@ -2708,15 +2708,12 @@
struct ast_variable *confvar = var;
int error = 0;
int start = 0, end = 0;
+ int oldparkinglot = 0;
parkinglot = find_parkinglot(name);
- /* TODO: confirm astobj2 doesn't have marking
if (parkinglot)
- ASTOBJ_UNMARK(parkinglot);
+ oldparkinglot = 1;
else
- parkinglot = create_parkinglot(name);
- */
- if (!parkinglot)
parkinglot = create_parkinglot(name);
if (!parkinglot)
@@ -2788,8 +2785,10 @@
ast_log(LOG_DEBUG, "Parking %s now open for business. (start exten %d end %d)\n", name, start, end);
- /* Move it into the list */
- ao2_link(parkinglots, parkinglot);
+ /* Move it into the list, if it wasn't already there */
+ if (!oldparkinglot) {
+ ao2_link(parkinglots, parkinglot);
+ }
parkinglot_unref(parkinglot);
return parkinglot;
@@ -3201,15 +3200,9 @@
int ast_features_reload(void)
{
int res;
- struct ast_parkinglot *curlot;
- struct ao2_iterator iter;
/* Release parking lot list */
//ASTOBJ_CONTAINER_MARKALL(&parkinglots);
- iter = ao2_iterator_init(parkinglots, 0);
- while ((curlot = ao2_iterator_next(&iter))) {
- parkinglot_unref(curlot);
- //ao2_unlink(parkinglots, curlot);
- }
+ // TODO: I don't think any marking is necessary
/* Reload configuration */
res = load_config();
@@ -3411,28 +3404,6 @@
ast_cli(a->fd, "%4s %25s (%-15s %-12s %-4s) %-6s \n", "Num", "Channel"
, "Context", "Extension", "Pri", "Timeout");
- /*
- ASTOBJ_CONTAINER_TRAVERSE(&parkinglots, 1, do {
- int lotparked = 0;
- ASTOBJ_RDLOCK(iterator);
- ast_cli(a->fd, "*** Parking lot: %s\n", iterator->name);
-
- AST_LIST_LOCK(&iterator->parkings);
- AST_LIST_TRAVERSE(&iterator->parkings, cur, list) {
- ast_cli(a->fd, "%-10.10s %25s (%-15s %-12s %-4d) %6lds\n"
- ,cur->parkingexten, cur->chan->name, cur->context, cur->exten
- ,cur->priority, cur->start.tv_sec + (cur->parkingtime/1000) - time(NULL));
- numparked++;
- numparked += lotparked;
- }
- AST_LIST_UNLOCK(&iterator->parkings);
- if (lotparked)
- ast_cli(a->fd, " %d parked call%s in parking lot %s\n", lotparked, ESS(lotparked), iterator->name);
-
- ASTOBJ_UNLOCK(iterator);
- } while (0) );
- */
-
iter = ao2_iterator_init(parkinglots, 0);
while ((curlot = ao2_iterator_next(&iter))) {
int lotparked = 0;
@@ -3495,9 +3466,6 @@
astman_send_ack(s, m, "Parked calls will follow");
- //ASTOBJ_CONTAINER_TRAVERSE(&parkinglots, 1, do {
- // ASTOBJ_RDLOCK(iterator);
- //
iter = ao2_iterator_init(parkinglots, 0);
while ((curlot = ao2_iterator_next(&iter))) {
@@ -3519,10 +3487,8 @@
idText);
}
AST_LIST_UNLOCK(&curlot->parkings);
-
- //ASTOBJ_UNLOCK(iterator);
ao2_ref(curlot, -1);
- } //while (0) );
+ }
astman_append(s,
"Event: ParkedCallsComplete\r\n"
@@ -3797,8 +3763,6 @@
ast_register_application2(app_bridge, bridge_exec, bridge_synopsis, bridge_descrip, NULL);
-
- //ASTOBJ_CONTAINER_INIT(&parkinglots);
parkinglots = ao2_container_alloc(7, parkinglot_hash_cb, parkinglot_cmp_cb);
if ((res = load_config()))
Modified: team/group/multiparking/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/main/pbx.c?view=diff&rev=114130&r1=114129&r2=114130
==============================================================================
--- team/group/multiparking/main/pbx.c (original)
+++ team/group/multiparking/main/pbx.c Mon Apr 14 15:25:14 2008
@@ -6425,7 +6425,7 @@
/* The pattern trie points to this exten; replace the pointer,
and all will be well */
- if (x->exten) { /* this test for safety purposes */
+ if (x && x->exten) { /* this test for safety purposes */
x->exten = tmp; /* replace what would become a bad pointer */
} else {
ast_log(LOG_ERROR,"Trying to delete an exten from a context, but the pattern tree node returned isn't an extension\n");
@@ -6447,7 +6447,7 @@
con->root = tmp;
/* The pattern trie points to this exten; replace the pointer,
and all will be well */
- if (x->exten) { /* this test for safety purposes */
+ if (x && x->exten) { /* this test for safety purposes */
x->exten = tmp; /* replace what would become a bad pointer */
} else {
ast_log(LOG_ERROR,"Trying to delete an exten from a context, but the pattern tree node returned isn't an extension\n");
More information about the svn-commits
mailing list