[asterisk-commits] dlee: branch dlee/ari-url-shuffle r391729 - in /team/dlee/ari-url-shuffle: re...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 13 15:56:25 CDT 2013


Author: dlee
Date: Thu Jun 13 15:56:24 2013
New Revision: 391729

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=391729
Log:
Improved error checking for event?app param

Modified:
    team/dlee/ari-url-shuffle/res/res_stasis_http_events.c
    team/dlee/ari-url-shuffle/res/stasis_http/resource_events.c
    team/dlee/ari-url-shuffle/rest-api-templates/res_stasis_http_resource.c.mustache

Modified: team/dlee/ari-url-shuffle/res/res_stasis_http_events.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-url-shuffle/res/res_stasis_http_events.c?view=diff&rev=391729&r1=391728&r2=391729
==============================================================================
--- team/dlee/ari-url-shuffle/res/res_stasis_http_events.c (original)
+++ team/dlee/ari-url-shuffle/res/res_stasis_http_events.c Thu Jun 13 15:56:24 2013
@@ -48,6 +48,7 @@
 static void event_websocket_ws_cb(struct ast_websocket *ws_session,
 	struct ast_variable *get_params, struct ast_variable *headers)
 {
+	RAII_VAR(struct ast_websocket *, s, ws_session, ast_websocket_unref);
 	RAII_VAR(struct ari_websocket_session *, session, NULL, ao2_cleanup);
 
 	struct ast_event_websocket_args args = {};

Modified: team/dlee/ari-url-shuffle/res/stasis_http/resource_events.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-url-shuffle/res/stasis_http/resource_events.c?view=diff&rev=391729&r1=391728&r2=391729
==============================================================================
--- team/dlee/ari-url-shuffle/res/stasis_http/resource_events.c (original)
+++ team/dlee/ari-url-shuffle/res/stasis_http/resource_events.c Thu Jun 13 15:56:24 2013
@@ -142,6 +142,10 @@
 	ast_assert(session->ws_session != NULL);
 	ast_assert(session->websocket_apps != NULL);
 
+	if (!app_list) {
+		return -1;
+	}
+
 	to_free = apps = ast_strdup(app_list);
 	if (!apps) {
 		ari_websocket_session_write(session->ws_session, ari_oom_json());
@@ -174,13 +178,7 @@
 		return;
 	}
 
-	res = session_register_apps(session, args->app);
-	if (res != 0) {
-		ari_websocket_session_write(ws_session, ari_oom_json());
-		return;
-	}
-
-	if (ao2_container_count(session->websocket_apps) == 0) {
+	if (!args->app) {
 		RAII_VAR(struct ast_json *, msg, NULL, ast_json_unref);
 
 		msg = ast_json_pack("{s: s, s: [s]}",
@@ -194,6 +192,12 @@
 		return;
 	}
 
+	res = session_register_apps(session, args->app);
+	if (res != 0) {
+		ari_websocket_session_write(ws_session, ari_oom_json());
+		return;
+	}
+
 	/* We don't process any input, but we'll consume it waiting for EOF */
 	while ((msg = ari_websocket_session_read(ws_session))) {
 		ast_json_unref(msg);

Modified: team/dlee/ari-url-shuffle/rest-api-templates/res_stasis_http_resource.c.mustache
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-url-shuffle/rest-api-templates/res_stasis_http_resource.c.mustache?view=diff&rev=391729&r1=391728&r2=391729
==============================================================================
--- team/dlee/ari-url-shuffle/rest-api-templates/res_stasis_http_resource.c.mustache (original)
+++ team/dlee/ari-url-shuffle/rest-api-templates/res_stasis_http_resource.c.mustache Thu Jun 13 15:56:24 2013
@@ -72,6 +72,7 @@
 static void {{c_nickname}}_ws_cb(struct ast_websocket *ws_session,
 	struct ast_variable *get_params, struct ast_variable *headers)
 {
+	RAII_VAR(struct ast_websocket *, s, ws_session, ast_websocket_unref);
 	RAII_VAR(struct ari_websocket_session *, session, NULL, ao2_cleanup);
 {{#has_path_parameters}}
 	/* TODO: It's not immediately obvious how to pass path params through




More information about the asterisk-commits mailing list