]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 268653,268731 via svnmerge from
authorTilghman Lesher <tilghman@meg.abyt.es>
Mon, 7 Jun 2010 19:00:37 +0000 (19:00 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Mon, 7 Jun 2010 19:00:37 +0000 (19:00 +0000)
https://origsvn.digium.com/svn/asterisk/trunk

........
  r268653 | tilghman | 2010-06-07 12:14:40 -0500 (Mon, 07 Jun 2010) | 2 lines

  Avoid unloading res_smdi twice.

  (closes issue #17237)
  Reported by: pabelanger
........
  r268731 | tilghman | 2010-06-07 13:59:27 -0500 (Mon, 07 Jun 2010) | 4 lines

  Event well was going dry.

  (issue #17234)
........

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.2@268732 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/manager.c
res/res_smdi.c

index 1932fde9a06bdc9e5f3c744e2238d0235576db0d..32884b7be6435f82cc8e0b4c0827b0dff95c0733 100644 (file)
@@ -360,6 +360,11 @@ static void purge_events(void)
        }
 
        AST_RWLIST_TRAVERSE_SAFE_BEGIN(&all_events, ev, eq_next) {
+               /* Never release the last event */
+               if (!AST_RWLIST_NEXT(ev, eq_next)) {
+                       break;
+               }
+
                /* 2.5 times whatever the HTTP timeout is (maximum 2.5 hours) is the maximum time that we will definitely cache an event */
                if (ev->usecount == 0 && ast_tvdiff_sec(now, ev->tv) > (httptimeout > 3600 ? 3600 : httptimeout) * 2.5) {
                        AST_RWLIST_REMOVE_CURRENT(eq_next);
index 669b065218eb5d431c3d38e6a88cc8b006530365..f0fa6f473939ee36e3989c21fb036f6b5a46a6a6 100644 (file)
@@ -58,6 +58,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #define SMDI_MSG_EXPIRY_TIME   30000 /* 30 seconds */
 
 static const char config_file[] = "smdi.conf";
+static int smdi_loaded;
 
 /*! \brief SMDI message desk message queue. */
 struct ast_smdi_md_queue {
@@ -1340,6 +1341,7 @@ static int _unload_module(int fromload);
 static int load_module(void)
 {
        int res;
+       smdi_loaded = 1;
 
        /* initialize our containers */
        memset(&smdi_ifaces, 0, sizeof(smdi_ifaces));
@@ -1367,6 +1369,10 @@ static int load_module(void)
 
 static int _unload_module(int fromload)
 {
+       if (!smdi_loaded) {
+               return 0;
+       }
+
        /* this destructor stops any running smdi_read threads */
        ASTOBJ_CONTAINER_DESTROYALL(&smdi_ifaces, ast_smdi_interface_destroy);
        ASTOBJ_CONTAINER_DESTROY(&smdi_ifaces);
@@ -1387,6 +1393,7 @@ static int _unload_module(int fromload)
                ast_custom_function_unregister(&smdi_msg_function);
        }
 
+       smdi_loaded = 0;
        return 0;
 }