[asterisk-commits] dlee: branch dlee/stasis-http r382355 - in /team/dlee/stasis-http: ./ apps/ res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 1 15:19:00 CST 2013


Author: dlee
Date: Fri Mar  1 15:18:57 2013
New Revision: 382355

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382355
Log:
Renamed statics to be consistent with stasis-core
........

Merged revisions 382354 from http://svn.asterisk.org/svn/asterisk/team/dlee/stasis-app

Modified:
    team/dlee/stasis-http/   (props changed)
    team/dlee/stasis-http/apps/app_stasis.c
    team/dlee/stasis-http/res/res_stasis_websocket.c

Propchange: team/dlee/stasis-http/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Mar  1 15:18:57 2013
@@ -1,1 +1,1 @@
-/team/dlee/stasis-app:1-382315
+/team/dlee/stasis-app:1-382354

Modified: team/dlee/stasis-http/apps/app_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/apps/app_stasis.c?view=diff&rev=382355&r1=382354&r2=382355
==============================================================================
--- team/dlee/stasis-http/apps/app_stasis.c (original)
+++ team/dlee/stasis-http/apps/app_stasis.c Fri Mar  1 15:18:57 2013
@@ -78,24 +78,24 @@
 #define CONTROLS_NUM_BUCKETS 127
 
 /*!
- * \brief Stasis application container. Please call stasis_apps() instead of
+ * \brief Stasis application container. Please call apps_registry() instead of
  * directly accessing.
  */
-struct ao2_container *__stasis_apps;
-
-struct ao2_container *__stasis_controls;
+struct ao2_container *__apps_registry;
+
+struct ao2_container *__app_controls;
 
 /*! Ref-counting accessor for the stasis applications container */
-static struct ao2_container *stasis_apps(void)
-{
-	ao2_ref(__stasis_apps, +1);
-	return __stasis_apps;
-}
-
-static struct ao2_container *stasis_contols(void)
-{
-	ao2_ref(__stasis_controls, +1);
-	return __stasis_controls;
+static struct ao2_container *apps_registry(void)
+{
+	ao2_ref(__apps_registry, +1);
+	return __apps_registry;
+}
+
+static struct ao2_container *app_controls(void)
+{
+	ao2_ref(__app_controls, +1);
+	return __app_controls;
 }
 
 struct stasis_app {
@@ -181,7 +181,7 @@
 	int continue_to_dialplan:1;
 };
 
-static void stasis_app_control_dtor(void *obj)
+static void app_control_dtor(void *obj)
 {
 	struct stasis_app_control *control = obj;
 	ast_free(control->channel_uniqueid);
@@ -191,7 +191,7 @@
 {
 	RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup);
 
-	control = ao2_alloc(sizeof(*control), stasis_app_control_dtor);
+	control = ao2_alloc(sizeof(*control), app_control_dtor);
 	if (!control) {
 		return NULL;
 	}
@@ -212,7 +212,7 @@
 		return NULL;
 	}
 
-	controls = stasis_contols();
+	controls = app_controls();
 	return ao2_find(controls, ast_channel_uniqueid(chan), OBJ_KEY);
 }
 
@@ -347,23 +347,23 @@
 
 /*!
  * \brief In addition to running ao2_cleanup(), this function also removes the
- * object from the stasis_controls() container.
+ * object from the app_controls() container.
  */
 static void control_unlink(struct stasis_app_control *control)
 {
 	RAII_VAR(struct ao2_container *, controls, NULL, ao2_cleanup);
 
 	if (control) {
-		controls = stasis_contols();
+		controls = app_controls();
 		ao2_unlink_flags(controls, control, OBJ_POINTER | OBJ_UNLINK | OBJ_NODATA);
 		ao2_cleanup(control);
 	}
 }
 
 /*! /brief Stasis dialplan application callback */
-static int stasis_exec(struct ast_channel *chan, const char *data)
-{
-	RAII_VAR(struct ao2_container *, apps, stasis_apps(), ao2_cleanup);
+static int app_stasis_exec(struct ast_channel *chan, const char *data)
+{
+	RAII_VAR(struct ao2_container *, apps, apps_registry(), ao2_cleanup);
 	RAII_VAR(struct stasis_app *, app, NULL, ao2_cleanup);
 	RAII_VAR(struct stasis_app_control *, control, NULL, control_unlink);
 	RAII_VAR(struct stasis_subscription *, subscription, NULL, stasis_unsubscribe);
@@ -397,7 +397,7 @@
 	{
 		RAII_VAR(struct ao2_container *, controls, NULL, ao2_cleanup);
 
-		controls = stasis_contols();
+		controls = app_controls();
 		control = control_create(ast_channel_uniqueid(chan));
 		if (!control) {
 			ast_log(LOG_ERROR, "Allocated failed\n");
@@ -449,7 +449,7 @@
 
 int stasis_app_send(const char *app_name, struct ast_json *message)
 {
-	RAII_VAR(struct ao2_container *, apps, stasis_apps(), ao2_cleanup);
+	RAII_VAR(struct ao2_container *, apps, apps_registry(), ao2_cleanup);
 	RAII_VAR(struct stasis_app *, app, NULL, ao2_cleanup);
 
 	app = ao2_find(apps, app_name, OBJ_KEY);
@@ -468,7 +468,7 @@
 
 int stasis_app_register(const char *app_name, stasis_app_cb handler, void *data)
 {
-	RAII_VAR(struct ao2_container *, apps, stasis_apps(), ao2_cleanup);
+	RAII_VAR(struct ao2_container *, apps, apps_registry(), ao2_cleanup);
 	RAII_VAR(struct stasis_app *, app, NULL, ao2_cleanup);
 
 	SCOPED_LOCK(apps_lock, apps, ao2_lock, ao2_unlock);
@@ -499,7 +499,7 @@
 
 void stasis_app_unregister(const char *app_name)
 {
-	RAII_VAR(struct ao2_container *, apps, stasis_apps(), ao2_cleanup);
+	RAII_VAR(struct ao2_container *, apps, apps_registry(), ao2_cleanup);
 
 	ao2_cleanup(ao2_find(apps, app_name, OBJ_KEY | OBJ_UNLINK));
 }
@@ -508,17 +508,17 @@
 {
 	int r = 0;
 
-	__stasis_apps = ao2_container_alloc(APPS_NUM_BUCKETS, app_hash, app_compare);
-	if (__stasis_apps == NULL) {
+	__apps_registry = ao2_container_alloc(APPS_NUM_BUCKETS, app_hash, app_compare);
+	if (__apps_registry == NULL) {
 		return AST_MODULE_LOAD_FAILURE;
 	}
 
-	__stasis_controls = ao2_container_alloc(CONTROLS_NUM_BUCKETS, app_hash, app_compare);
-	if (__stasis_controls == NULL) {
+	__app_controls = ao2_container_alloc(CONTROLS_NUM_BUCKETS, app_hash, app_compare);
+	if (__app_controls == NULL) {
 		return AST_MODULE_LOAD_FAILURE;
 	}
 
-	r |= ast_register_application_xml(stasis, stasis_exec);
+	r |= ast_register_application_xml(stasis, app_stasis_exec);
 	return r;
 }
 
@@ -526,11 +526,11 @@
 {
 	int r = 0;
 
-	ao2_cleanup(__stasis_apps);
-	__stasis_apps = NULL;
-
-	ao2_cleanup(__stasis_controls);
-	__stasis_controls = NULL;
+	ao2_cleanup(__apps_registry);
+	__apps_registry = NULL;
+
+	ao2_cleanup(__app_controls);
+	__app_controls = NULL;
 
 	r |= ast_unregister_application(stasis);
 	return r;

Modified: team/dlee/stasis-http/res/res_stasis_websocket.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/res/res_stasis_websocket.c?view=diff&rev=382355&r1=382354&r2=382355
==============================================================================
--- team/dlee/stasis-http/res/res_stasis_websocket.c (original)
+++ team/dlee/stasis-http/res/res_stasis_websocket.c Fri Mar  1 15:18:57 2013
@@ -149,7 +149,7 @@
 }
 
 
-static struct ast_json *stasis_websocket_process_req(struct stasis_ws_session_info *session, struct ast_json *req)
+static struct ast_json *websocket_process_req(struct stasis_ws_session_info *session, struct ast_json *req)
 {
 	const char *command = ast_json_string_get(ast_json_object_get(req, "command"));
 	struct ast_json *id_json = ast_json_object_get(req, "id");
@@ -210,7 +210,7 @@
 	}
 }
 
-static void stasis_websocket_callback(struct ast_websocket *session, struct ast_variable *parameters, struct ast_variable *headers)
+static void websocket_callback(struct ast_websocket *session, struct ast_variable *parameters, struct ast_variable *headers)
 {
 	struct stasis_ws_session_info stasis_session = {};
         struct ao2_iterator i;
@@ -258,7 +258,7 @@
 					ast_log(LOG_ERROR, "Error building error message. That's just messed up.\n");
 				}
 			} else {
-				resp = stasis_websocket_process_req(&stasis_session, req);
+				resp = websocket_process_req(&stasis_session, req);
 			}
 
 			if (resp) {
@@ -283,7 +283,7 @@
 {
 	int r = 0;
 
-        r |= ast_websocket_add_protocol(ws_protocol, stasis_websocket_callback);
+        r |= ast_websocket_add_protocol(ws_protocol, websocket_callback);
 	return r;
 }
 
@@ -291,7 +291,7 @@
 {
 	int r = 0;
 
-        r |= ast_websocket_remove_protocol(ws_protocol, stasis_websocket_callback);
+        r |= ast_websocket_remove_protocol(ws_protocol, websocket_callback);
 	return r;
 }
 




More information about the asterisk-commits mailing list