<p>George Joseph <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/5852">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_voicemail: IMAP logout on reload/unload<br><br>Closing IMAP connection on module reload or unload.<br><br>ASTERISK-24052 #close<br><br>Change-Id: I2a40182aa9ef249fa6865d33570430e9ada68525<br>---<br>M apps/app_voicemail.c<br>1 file changed, 23 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c<br>index 0c0e2ba..2152cca 100644<br>--- a/apps/app_voicemail.c<br>+++ b/apps/app_voicemail.c<br>@@ -13057,10 +13057,25 @@<br> return;<br> }<br> <br>+ ast_mutex_lock(&vms->lock);<br> vms->mailstream = mail_close(vms->mailstream);<br>+ ast_mutex_unlock(&vms->lock);<br>+<br> vmstate_delete(vms);<br> }<br> <br>+static void imap_close_subscribed_mailboxes(void)<br>+{<br>+ struct mwi_sub *mwi_sub;<br>+<br>+ AST_RWLIST_RDLOCK(&mwi_subs);<br>+ AST_RWLIST_TRAVERSE(&mwi_subs, mwi_sub, entry) {<br>+ if (!ast_strlen_zero(mwi_sub->mailbox)) {<br>+ imap_logout(mwi_sub->mailbox);<br>+ }<br>+ }<br>+ AST_RWLIST_UNLOCK(&mwi_subs);<br>+}<br> #endif<br> <br> static int handle_unsubscribe(void *datap)<br>@@ -13514,7 +13529,11 @@<br> strcpy(listen_control_restart_key, DEFAULT_LISTEN_CONTROL_RESTART_KEY);<br> strcpy(listen_control_stop_key, DEFAULT_LISTEN_CONTROL_STOP_KEY);<br> <br>- /* Free all the users structure */ <br>+#ifdef IMAP_STORAGE<br>+ imap_close_subscribed_mailboxes();<br>+#endif<br>+<br>+ /* Free all the users structure */<br> free_vm_users();<br> <br> /* Free all the zones structure */<br>@@ -14908,6 +14927,9 @@<br> ast_unload_realtime("voicemail");<br> ast_unload_realtime("voicemail_data");<br> <br>+#ifdef IMAP_STORAGE<br>+ imap_close_subscribed_mailboxes();<br>+#endif<br> free_vm_users();<br> free_vm_zones();<br> return res;<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/5852">change 5852</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/5852"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I2a40182aa9ef249fa6865d33570430e9ada68525 </div>
<div style="display:none"> Gerrit-Change-Number: 5852 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Alexei Gradinari <alex2grad@gmail.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>