From bf579222c4812a54daa7ab17774899a3c5afb7dd Mon Sep 17 00:00:00 2001
From: Joshua Colp <jcolp@digium.com>
Date: Mon, 5 Nov 2018 14:30:54 +0000
Subject: [PATCH] stasis: Clarify lifetime of topics.

As mentioned in the comment I've added in the code there is no
ability to unsubscribe all subscribers from a topic and explicitly
destroy it. This is not currently a problem as we have two types of
topics:

Long lived topics which exist for the lifetime of the system.
Ephemeral topics which feed a long lived topic.

In the case of the ephemeral topics there is no subscriber which does
not have its lifetime managed by the same entity that has created
the topic. This ensures that when the topic is being unreferenced the
subscribers are also unsubscribed and destroyed, allowing the topic
to ultimately be destroyed as well.

Change-Id: Ic5e244da7b16b1895ba1fc5ece481ebba5809c9a
---
 include/asterisk/stasis.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/asterisk/stasis.h b/include/asterisk/stasis.h
index 8329dd0924..2b56b53f81 100644
--- a/include/asterisk/stasis.h
+++ b/include/asterisk/stasis.h
@@ -477,6 +477,11 @@ struct stasis_topic;
  * \return New topic instance.
  * \return \c NULL on error.
  * \since 12
+ *
+ * \note There is no explicit ability to unsubscribe all subscribers
+ * from a topic and destroy it. As a result the topic can persist until
+ * the last subscriber unsubscribes itself even if there is no
+ * publisher.
  */
 struct stasis_topic *stasis_topic_create(const char *name);
 
-- 
GitLab