]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
adding mg and peer profile cleanup code during shutdown and removing
authorkapil <kgupta@sangoma.com>
Mon, 25 Jun 2012 06:42:04 +0000 (12:12 +0530)
committerkapil <kgupta@sangoma.com>
Mon, 25 Jun 2012 06:42:04 +0000 (12:12 +0530)
"unused variables" warnings

src/mod/endpoints/mod_media_gateway/media_gateway.c
src/mod/endpoints/mod_media_gateway/media_gateway_xml.c
src/mod/endpoints/mod_media_gateway/mod_media_gateway.c
src/mod/endpoints/mod_media_gateway/mod_media_gateway.h

index 98d433179ebbdb36511d6351a8c529294df356b7..3cd5856bd2a63f93f01c0018e6a1f3147da89064 100644 (file)
@@ -107,6 +107,21 @@ switch_status_t megaco_profile_destroy(megaco_profile_t **profile)
        return SWITCH_STATUS_SUCCESS;   
 }
 
+switch_status_t megaco_peer_profile_destroy(mg_peer_profile_t **profile) 
+{
+
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Stopping peer profile: %s\n", (*profile)->name);        
+       
+       switch_core_hash_delete_wrlock(megaco_globals.peer_profile_hash, (*profile)->name, megaco_globals.peer_profile_rwlock);
+       
+       mg_peer_config_cleanup(*profile);
+
+       switch_core_destroy_memory_pool(&(*profile)->pool);
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Stopped peer profile: %s\n", (*profile)->name); 
+       
+       return SWITCH_STATUS_SUCCESS;   
+}
+
 /* For Emacs:
  * Local Variables:
  * mode:c
index 9e6b7fc1ad76ba3f908376f6bb4d636aebc13a24..c48032e30c9df088df63c0b3d8df1f9fc07c965e 100644 (file)
@@ -133,6 +133,15 @@ switch_status_t mg_config_cleanup(megaco_profile_t* profile)
        return SWITCH_STATUS_SUCCESS;
 }
 
+/****************************************************************************************************************************/
+switch_status_t mg_peer_config_cleanup(mg_peer_profile_t* profile)
+{
+       switch_xml_config_item_t *instructions = (profile ? get_peer_instructions(profile) : NULL);
+       switch_xml_config_cleanup(instructions);
+
+       return SWITCH_STATUS_SUCCESS;
+}
+
 /****************************************************************************************************************************/
 static switch_xml_config_item_t *get_peer_instructions(mg_peer_profile_t *profile) {
        switch_xml_config_item_t *dup;
index 1423df9cdad30a7538be1447a2d80e506662543d..b056d91bba0c2058355b512e42b4fd98b1dbeb29 100644 (file)
@@ -97,6 +97,32 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_media_gateway_load)
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_media_gateway_shutdown)
 {
+       void            *val = NULL;
+        const void     *key = NULL;
+        switch_ssize_t   keylen;
+       switch_hash_index_t *hi = NULL;
+       megaco_profile_t*    profile = NULL;
+       mg_peer_profile_t*    peer_profile = NULL;
+
+       /* destroy all the mg profiles */
+       while ((hi = switch_hash_first(NULL, megaco_globals.profile_hash))) {
+               switch_hash_this(hi, &key, &keylen, &val);
+               profile = (megaco_profile_t *) val;
+               megaco_profile_destroy(&profile);
+               profile = NULL;
+       }
+
+       hi = NULL;
+       key = NULL;
+       val = NULL;
+       /* destroy all the mg peer profiles */
+       while ((hi = switch_hash_first(NULL, megaco_globals.peer_profile_hash))) {
+               switch_hash_this(hi, &key, &keylen, &val);
+               peer_profile = (mg_peer_profile_t *) val;
+               megaco_peer_profile_destroy(&peer_profile);
+               peer_profile = NULL;
+       }
+
        sng_mgco_stack_shutdown();
 
        return SWITCH_STATUS_SUCCESS;
@@ -156,7 +182,7 @@ static void mgco_print_sdp(CmSdpInfoSet *sdp)
             }
             if (s->attrSet.numComp.pres) {
                 for (mediaId = 0; mediaId < s->attrSet.numComp.val; mediaId++) {
-                    CmSdpAttr *a = s->attrSet.attr[mediaId];
+                    /*CmSdpAttr *a = s->attrSet.attr[mediaId];*/
                     
                     
                 }
@@ -221,9 +247,10 @@ void handle_mgco_txn_ind(Pst *pst, SuId suId, MgMgcoMsg* msg)
                         /* Loop over command list */
                         for (cmdIter=0; cmdIter < (actnReq->cl.num.val); cmdIter++) {
                             MgMgcoCommandReq *cmdReq = actnReq->cl.cmds[cmdIter];
-                            MgMgcoTermId *termId = NULLP;
+                            /*MgMgcoTermId *termId = NULLP;*/
                             /* The reply we'll send */
-                            MgMgcoCommand mgCmd = {0};
+                            MgMgcoCommand mgCmd;
+                           memset(&mgCmd, 0, sizeof(mgCmd));
                             mgCmd.peerId = msg->lcl.id;
                             mgCmd.transId = transId;
                             mgCmd.u.mgCmdInd[0] = cmdReq;
@@ -328,18 +355,18 @@ void handle_mgco_txn_ind(Pst *pst, SuId suId, MgMgcoMsg* msg)
                                 }
                                 case MGT_MODIFY:
                                 {
-                                    MgMgcoAmmReq *addReq = &cmdReq->cmd.u.mod;
+                                    /*MgMgcoAmmReq *addReq = &cmdReq->cmd.u.mod;*/
                                     break;
                                 }
                                 case MGT_MOVE:
                                 {
-                                    MgMgcoAmmReq *addReq = &cmdReq->cmd.u.move;
+                                    /*MgMgcoAmmReq *addReq = &cmdReq->cmd.u.move;*/
                                     break;
                                     
                                 }
                                 case MGT_SUB:
                                 {
-                                    MgMgcoSubAudReq *addReq = &cmdReq->cmd.u.sub;
+                                    /*MgMgcoSubAudReq *addReq = &cmdReq->cmd.u.sub;*/
                                 }
                                 case MGT_SVCCHG:
                                 case MGT_NTFY:
index d4c6e430774e12b7cd3c49f4274337295f9a2d94..8aa0dae0d3902871dacddaedb61e0e55d7396566 100644 (file)
@@ -84,6 +84,8 @@ switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t reload);
 switch_status_t sng_mgco_start(megaco_profile_t* profile);
 switch_status_t sng_mgco_stop(megaco_profile_t* profile);
 switch_status_t mg_config_cleanup(megaco_profile_t* profile);
+switch_status_t mg_peer_config_cleanup(mg_peer_profile_t* profile);
+switch_status_t megaco_peer_profile_destroy(mg_peer_profile_t **profile); 
 switch_status_t mg_process_cli_cmd(const char *cmd, switch_stream_handle_t *stream);