[svn-commits] dlee: trunk r395527 - in /trunk/res: stasis/app.c stasis_http/resource_events.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Jul 26 12:42:09 CDT 2013


Author: dlee
Date: Fri Jul 26 12:42:08 2013
New Revision: 395527

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395527
Log:
Fix /stasis/res/app_replaced unit test.

A typo in recent changes caused the JSON ApplicationReplaced message to
fail to build, so the message wasn't being sent out the WebSocket.

Related, the replaced application would also unregister itself when it
disconnected, which would actually unregister the new application. This
was also fixed.

Modified:
    trunk/res/stasis/app.c
    trunk/res/stasis_http/resource_events.c

Modified: trunk/res/stasis/app.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/stasis/app.c?view=diff&rev=395527&r1=395526&r2=395527
==============================================================================
--- trunk/res/stasis/app.c (original)
+++ trunk/res/stasis/app.c Fri Jul 26 12:42:08 2013
@@ -221,7 +221,7 @@
 
 		msg = ast_json_pack("{s: s, s: s}",
 			"type", "ApplicationReplaced",
-			"application", app_name);
+			"application", app->name);
 		if (msg) {
 			app_send(app, msg);
 		}

Modified: trunk/res/stasis_http/resource_events.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/stasis_http/resource_events.c?view=diff&rev=395527&r1=395526&r2=395527
==============================================================================
--- trunk/res/stasis_http/resource_events.c (original)
+++ trunk/res/stasis_http/resource_events.c Fri Jul 26 12:42:08 2013
@@ -113,6 +113,19 @@
 {
 	struct event_session *session = data;
 	int res;
+	const char *msg_type = S_OR(
+		ast_json_string_get(ast_json_object_get(message, "type")),
+		"");
+	const char *msg_application = S_OR(
+		ast_json_string_get(ast_json_object_get(message, "application")),
+		"");
+
+	/* Determine if we've been replaced */
+	if (strcmp(msg_type, "ApplicationReplaced") == 0 &&
+		strcmp(msg_application, app_name) == 0) {
+		ao2_find(session->websocket_apps, msg_application,
+			OBJ_UNLINK | OBJ_NODATA);
+	}
 
 	res = ast_json_object_set(message, "application",
 				  ast_json_string_create(app_name));




More information about the svn-commits mailing list