mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 11:25:35 +00:00
res_stasis: trigger cleanup after update
The cleanup code in stasis shuts down applications if they are in a deactivated state, and no longer have explicit subscriptions. When registering an app the cleanup code was running before calling 'update'. When it should be executed after 'update' since a call to register may re-activate the app. We don't want it to shutdown before the 'update' otherwise the app won't be re-activated, or registered. This patch makes it so the cleanup code is executed post 'update'. ASTERISK-28679 #close Change-Id: I8f2c0b17e33bb8128441567b97fd4c7bf74a327b
This commit is contained in:
@@ -1715,12 +1715,11 @@ static int __stasis_app_register(const char *app_name, stasis_app_cb handler, vo
|
|||||||
if (app) {
|
if (app) {
|
||||||
/*
|
/*
|
||||||
* We need to unlock the apps_registry before calling app_update to
|
* We need to unlock the apps_registry before calling app_update to
|
||||||
* prevent the possibility of a deadlock with the session. We'll still
|
* prevent the possibility of a deadlock with the session.
|
||||||
* run the lazy cleanup first though.
|
|
||||||
*/
|
*/
|
||||||
cleanup();
|
|
||||||
ao2_unlock(apps_registry);
|
ao2_unlock(apps_registry);
|
||||||
app_update(app, handler, data);
|
app_update(app, handler, data);
|
||||||
|
cleanup();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1745,11 +1744,12 @@ static int __stasis_app_register(const char *app_name, stasis_app_cb handler, vo
|
|||||||
}
|
}
|
||||||
ao2_link_flags(apps_registry, app, OBJ_NOLOCK);
|
ao2_link_flags(apps_registry, app, OBJ_NOLOCK);
|
||||||
|
|
||||||
|
ao2_unlock(apps_registry);
|
||||||
|
|
||||||
/* We lazily clean up the apps_registry, because it's good enough to
|
/* We lazily clean up the apps_registry, because it's good enough to
|
||||||
* prevent memory leaks, and we're lazy.
|
* prevent memory leaks, and we're lazy.
|
||||||
*/
|
*/
|
||||||
cleanup();
|
cleanup();
|
||||||
ao2_unlock(apps_registry);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user