summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/stasis/app.c2
-rw-r--r--res/stasis_http/resource_events.c13
2 files changed, 14 insertions, 1 deletions
diff --git a/res/stasis/app.c b/res/stasis/app.c
index dfb6df338..6f80ed64a 100644
--- a/res/stasis/app.c
+++ b/res/stasis/app.c
@@ -221,7 +221,7 @@ void app_update(struct app *app, stasis_app_cb handler, void *data)
msg = ast_json_pack("{s: s, s: s}",
"type", "ApplicationReplaced",
- "application", app_name);
+ "application", app->name);
if (msg) {
app_send(app, msg);
}
diff --git a/res/stasis_http/resource_events.c b/res/stasis_http/resource_events.c
index 9e9bfab3e..d632339c0 100644
--- a/res/stasis_http/resource_events.c
+++ b/res/stasis_http/resource_events.c
@@ -113,6 +113,19 @@ static void app_handler(void *data, const char *app_name,
{
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));