<p>Alexei Gradinari has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/5852">View Change</a></p><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, 20 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/52/5852/1</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..e4bdfbb 100644<br>--- a/apps/app_voicemail.c<br>+++ b/apps/app_voicemail.c<br>@@ -13061,6 +13061,18 @@<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 +13526,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 +14924,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: newchange </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: 1 </div>
<div style="display:none"> Gerrit-Owner: Alexei Gradinari <alex2grad@gmail.com> </div>