[svn-commits] twilson: trunk r356314 - in /trunk: ./ include/asterisk/ main/ res/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Feb 22 15:22:53 CST 2012
Author: twilson
Date: Wed Feb 22 15:22:43 2012
New Revision: 356314
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=356314
Log:
Track module use count for res_calendar
If the res_calendar module was followed immediately by one of the
calendar tech modules and "core stop gracefully" was run, Asterisk
would crash.
This patch adds use count tracking for res_calendar so that it is
unloaded after the tech modules when shutting down gracefully. It
is now not possible to unload all the of the calendar modules via
"module unload res_calednar.so", but it is still possible to unload
them all via "module unload -h res_calendar.so".
Review: https://reviewboard.asterisk.org/r/1752/
........
Merged revisions 356291 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 356297 from http://svn.asterisk.org/svn/asterisk/branches/10
Modified:
trunk/ (props changed)
trunk/include/asterisk/calendar.h
trunk/main/loader.c
trunk/res/res_calendar.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.
Modified: trunk/include/asterisk/calendar.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/calendar.h?view=diff&rev=356314&r1=356313&r2=356314
==============================================================================
--- trunk/include/asterisk/calendar.h (original)
+++ trunk/include/asterisk/calendar.h Wed Feb 22 15:22:43 2012
@@ -25,6 +25,7 @@
#include "asterisk/linkedlists.h"
#include "asterisk/lock.h"
#include "asterisk/dial.h"
+#include "asterisk/module.h"
/*! \file calendar.h
* \brief A general API for managing calendar events with Asterisk
@@ -69,6 +70,7 @@
const char *type;
const char *description;
const char *module;
+ struct ast_module_user *user;
int (* is_busy)(struct ast_calendar *calendar); /*!< Override default busy determination */
void *(* load_calendar)(void *data); /*!< Create private structure, add calendar events, etc. */
void *(* unref_calendar)(void *obj); /*!< Function to be called to free the private structure */
Modified: trunk/main/loader.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/loader.c?view=diff&rev=356314&r1=356313&r2=356314
==============================================================================
--- trunk/main/loader.c (original)
+++ trunk/main/loader.c Wed Feb 22 15:22:43 2012
@@ -239,7 +239,9 @@
AST_LIST_LOCK(&mod->users);
while ((u = AST_LIST_REMOVE_HEAD(&mod->users, entry))) {
- ast_softhangup(u->chan, AST_SOFTHANGUP_APPUNLOAD);
+ if (u->chan) {
+ ast_softhangup(u->chan, AST_SOFTHANGUP_APPUNLOAD);
+ }
ast_atomic_fetchadd_int(&mod->usecount, -1);
ast_free(u);
}
Modified: trunk/res/res_calendar.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_calendar.c?view=diff&rev=356314&r1=356313&r2=356314
==============================================================================
--- trunk/res/res_calendar.c (original)
+++ trunk/res/res_calendar.c Wed Feb 22 15:22:43 2012
@@ -532,6 +532,7 @@
}
}
AST_LIST_INSERT_HEAD(&techs, tech, list);
+ tech->user = ast_module_user_add(NULL);
AST_LIST_UNLOCK(&techs);
ast_verb(2, "Registered calendar type '%s' (%s)\n", tech->type, tech->description);
@@ -564,6 +565,7 @@
ao2_callback(calendars, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE, match_caltech_cb, tech);
AST_LIST_REMOVE_CURRENT(list);
+ ast_module_user_remove(iter->user);
ast_verb(2, "Unregistered calendar type '%s'\n", tech->type);
break;
}
More information about the svn-commits
mailing list