[asterisk-commits] may: trunk r404321 - in /trunk: ./ addons/ addons/ooh323c/src/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Dec 19 02:35:34 CST 2013


Author: may
Date: Thu Dec 19 02:35:28 2013
New Revision: 404321

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=404321
Log:
Handle temporary failures on gk registration
Introduce new 'stopped' state for gk client and restart gk client
on failures
Remove ooh323 stack command lock as it is not need now.
(closes issue ASTERISK-21960)
Reported by: Dmitry Melekhov
Patches:
	ASTERISK-21960.patch
	ASTERISK-21960-stacklockup-2.patch
Tested by: Dmitry Melekhov
........

Merged revisions 404318 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 404320 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/addons/chan_ooh323.c
    trunk/addons/ooh323c/src/ooGkClient.c
    trunk/addons/ooh323c/src/ooGkClient.h
    trunk/addons/ooh323c/src/oochannels.c

Propchange: trunk/
------------------------------------------------------------------------------
--- branch-12-merged (original)
+++ branch-12-merged Thu Dec 19 02:35:28 2013
@@ -1,1 +1,1 @@
-/branches/12:1-398558,398560-398577,398579-399305,399307-401390,401392-403290,403292-403778,403781-404006,404027,404029,404042,404046,404048,404050,404099,404137,404184,404204,404237,404261,404263,404279,404292,404294,404306
+/branches/12:1-398558,398560-398577,398579-399305,399307-401390,401392-403290,403292-403778,403781-404006,404027,404029,404042,404046,404048,404050,404099,404137,404184,404204,404237,404261,404263,404279,404292,404294,404306,404320

Modified: trunk/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/chan_ooh323.c?view=diff&rev=404321&r1=404320&r2=404321
==============================================================================
--- trunk/addons/chan_ooh323.c (original)
+++ trunk/addons/chan_ooh323.c Thu Dec 19 02:35:28 2013
@@ -295,8 +295,6 @@
 static int usecnt = 0;
 AST_MUTEX_DEFINE_STATIC(usecnt_lock);
 
-AST_MUTEX_DEFINE_STATIC(ooh323c_cmd_lock);
-
 static long callnumber = 0;
 AST_MUTEX_DEFINE_STATIC(ooh323c_cn_lock);
 
@@ -696,7 +694,7 @@
 			ooh323_destroy(p);
 			ast_mutex_unlock(&iflock);
 			return NULL;
-		} else if (gH323ep.gkClient && gH323ep.gkClient->state != GkClientRegistered) {
+		} else if (!gH323ep.gkClient || (gH323ep.gkClient && gH323ep.gkClient->state != GkClientRegistered)) {
 			ast_log(LOG_ERROR, "Gatekeeper client is configured but not registered\n");
 			*cause = AST_CAUSE_NORMAL_TEMPORARY_FAILURE;
 			return NULL;
@@ -751,7 +749,6 @@
       		}
 
       		ast_mutex_unlock(&p->lock);
-      		ast_mutex_lock(&ooh323c_cmd_lock);
 		ast_cond_init(&p->rtpcond, NULL);
       		ooMakeCall(data, p->callToken, AST_MAX_EXTENSION, NULL);
 		ast_mutex_lock(&p->lock);
@@ -760,7 +757,6 @@
 		}
 		ast_mutex_unlock(&p->lock);
 		ast_cond_destroy(&p->rtpcond);
-      		ast_mutex_unlock(&ooh323c_cmd_lock);
 	}
 
 	restart_monitor();
@@ -3505,6 +3501,9 @@
 	case GkClientFailed:
 		ast_cli(a->fd, "%-20s%s\n", "GK state:", "Failed");
 		break;
+	case GkClientStopped:
+		ast_cli(a->fd, "%-20s%s\n", "GK state:", "Shutdown");
+		break;
 	default:
 		break;
 	}
@@ -3945,6 +3944,13 @@
 		if (reloading) {
 			ast_verb(1, "Reloading H.323\n");
 			ooh323_do_reload();
+		}
+		if (gH323ep.gkClient && gH323ep.gkClient->state == GkClientStopped) {
+			ooGkClientDestroy();
+			ast_verb(0, "Restart stopped gatekeeper client\n");
+			ooGkClientInit(gRasGkMode, (gRasGkMode == RasUseSpecificGatekeeper) ? 
+									gGatekeeper : 0, 0);
+			ooGkClientStart(gH323ep.gkClient);
 		}
 
 		/* Check for interfaces needing to be killed */

Modified: trunk/addons/ooh323c/src/ooGkClient.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/ooGkClient.c?view=diff&rev=404321&r1=404320&r2=404321
==============================================================================
--- trunk/addons/ooh323c/src/ooGkClient.c (original)
+++ trunk/addons/ooh323c/src/ooGkClient.c Thu Dec 19 02:35:28 2013
@@ -2851,13 +2851,13 @@
       {
          OOTRACEERR1("Error: Gatekeeper error detected. Closing GkClient as "
                      "Gk mode is UseSpecifcGatekeeper\n");
-         ooGkClientDestroy();
+	 pGkClient->state = GkClientStopped;
          return OO_FAILED;
       }
       else{
          OOTRACEERR1("Error: Gatekeeper error detected. Closing GkClient. NEED"
                     " to implement recovery by rediscovering another gk\n");
-         ooGkClientDestroy();
+	 pGkClient->state = GkClientStopped;
          return OO_FAILED;
       }
    }

Modified: trunk/addons/ooh323c/src/ooGkClient.h
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/ooGkClient.h?view=diff&rev=404321&r1=404320&r2=404321
==============================================================================
--- trunk/addons/ooh323c/src/ooGkClient.h (original)
+++ trunk/addons/ooh323c/src/ooGkClient.h Thu Dec 19 02:35:28 2013
@@ -108,7 +108,8 @@
    GkClientRegistered, /* registered with gk */
    GkClientUnregistered,
    GkClientGkErr,/*Gk is not responding, in discover mode can look for new GK*/
-   GkClientFailed
+   GkClientFailed,
+   GkClientStopped
 };
    
 

Modified: trunk/addons/ooh323c/src/oochannels.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/oochannels.c?view=diff&rev=404321&r1=404320&r2=404321
==============================================================================
--- trunk/addons/ooh323c/src/oochannels.c (original)
+++ trunk/addons/ooh323c/src/oochannels.c Thu Dec 19 02:35:28 2013
@@ -603,11 +603,7 @@
       if(gH323ep.gkClient->state == GkClientFailed ||
          gH323ep.gkClient->state == GkClientGkErr)
       {
-         if(ooGkClientHandleClientOrGkFailure(gH323ep.gkClient)!=OO_OK)
-         {
-            //ooStopMonitorCalls(); //Function calling ooProcessFDSETsAndTimers is responsible for this.
-            return OO_FAILED;
-         }
+         ooGkClientHandleClientOrGkFailure(gH323ep.gkClient);
       }
    }
 




More information about the asterisk-commits mailing list