<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/6085">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
  George Joseph: Looks good to me, approved

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_stasis_device_state: Unsubscribe should remove old subscriptions<br><br>Case scenario with Applications ARI:<br><br>* Once you subscribe to deviceState with Applications REST API, it will be<br>added into subscription pool.<br><br>* When you unsubscribe it will remove from the device_state_subscription<br>hash table but not from the subscription pool.<br><br>* When you subscribe again, it will add it to pool again.<br><br>* Now you will have two subscriptions and you will receive same event<br>twice.<br><br>This fix should now remove deviceState subscription from pool and it<br>should fix unsubscribe on deviceState.<br><br>ASTERISK-27130 #close<br><br>Change-Id: I718b70d770a086e39b4ddba4f69a3c616d4476c4<br>---<br>M res/res_stasis_device_state.c<br>1 file changed, 3 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/res/res_stasis_device_state.c b/res/res_stasis_device_state.c<br>index 344cb40..276a98b 100644<br>--- a/res/res_stasis_device_state.c<br>+++ b/res/res_stasis_device_state.c<br>@@ -106,7 +106,6 @@<br> static void device_state_subscription_destroy(void *obj)<br> {<br>     struct device_state_subscription *sub = obj;<br>- sub->sub = stasis_unsubscribe_and_join(sub->sub);<br>       ast_string_field_free_memory(sub);<br> }<br> <br>@@ -152,6 +151,9 @@<br> static void remove_device_state_subscription(<br>        struct device_state_subscription *sub)<br> {<br>+   if (sub->sub) {<br>+           sub->sub = stasis_unsubscribe_and_join(sub->sub);<br>+      }<br>     ao2_unlink_flags(device_state_subscriptions, sub, OBJ_NOLOCK);<br> }<br> <br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6085">change 6085</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/6085"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I718b70d770a086e39b4ddba4f69a3c616d4476c4 </div>
<div style="display:none"> Gerrit-Change-Number: 6085 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Sergej Kasumovic <sergej@bicomsystems.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>