<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://reviewboard.asterisk.org/r/2540/">https://reviewboard.asterisk.org/r/2540/</a>
     </td>
    </tr>
   </table>
   <br />



<table bgcolor="#e0e0e0" width="100%" cellpadding="8" style="border: 1px gray solid;">
 <tr>
  <td>
   <h1 style="margin-right: 0.2em; padding: 0; font-size: 10pt;">This change has been marked as submitted.</h1>
  </td>
 </tr>
</table>
<br />


<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/static/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for Asterisk Developers, Matt Jordan and opticron.</div>
<div>By David Lee.</div>


<p style="color: grey;"><i>Updated May 17, 2013, 4:10 p.m.</i></p>



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Changes</h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Committed in revision 389011</pre>
  </td>
 </tr>
</table>







<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
Asterisk
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">In r388005, macros were introduced to consistently define message
types. This added an assert if a message type was used either before
it was initialized or after it had been cleaned up. It turns out that
this assertion fires during shutdown.

This actually exposed a hidden shutdown ordering problem. Since
unsubscribing is asynchronous, it&#39;s possible that the message types
used by the subscription could be freed before the final message of
the subscription was processed.

This patch adds stasis_subscription_join(), which blocks until the
last message has been processed by the subscription. Since joining was
most commonly done right after an unsubscribe, a
stasis_unsubscribe_and_join() convenience function was also added.

Similar functions were also added to the stasis_caching_topic and
stasis_message_router, since they wrap subscriptions and have similar
problems.

Other code in trunk was refactored to join() where appropriate, or at
least verify that the subscription was complete before being
destroyed.

Review: https://reviewboard.asterisk.org/r/2540</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Ran unit tests; core stop now and core stop gracefully.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>/trunk/main/devicestate.c <span style="color: grey">(388689)</span></li>

 <li>/trunk/main/app.c <span style="color: grey">(388689)</span></li>

 <li>/trunk/include/asterisk/stasis_message_router.h <span style="color: grey">(388689)</span></li>

 <li>/trunk/include/asterisk/stasis.h <span style="color: grey">(388689)</span></li>

 <li>/trunk/channels/chan_sip.c <span style="color: grey">(388689)</span></li>

 <li>/trunk/funcs/func_presencestate.c <span style="color: grey">(388689)</span></li>

 <li>/trunk/channels/chan_iax2.c <span style="color: grey">(388689)</span></li>

 <li>/trunk/apps/app_voicemail.c <span style="color: grey">(388689)</span></li>

 <li>/trunk/apps/app_queue.c <span style="color: grey">(388689)</span></li>

 <li>/trunk/main/endpoints.c <span style="color: grey">(388689)</span></li>

 <li>/trunk/main/manager.c <span style="color: grey">(388689)</span></li>

 <li>/trunk/main/manager_channels.c <span style="color: grey">(388689)</span></li>

 <li>/trunk/main/pbx.c <span style="color: grey">(388689)</span></li>

 <li>/trunk/main/stasis.c <span style="color: grey">(388689)</span></li>

 <li>/trunk/main/stasis_cache.c <span style="color: grey">(388689)</span></li>

 <li>/trunk/main/stasis_channels.c <span style="color: grey">(388689)</span></li>

 <li>/trunk/main/stasis_endpoints.c <span style="color: grey">(388689)</span></li>

 <li>/trunk/main/stasis_message_router.c <span style="color: grey">(388689)</span></li>

 <li>/trunk/res/res_chan_stats.c <span style="color: grey">(388689)</span></li>

 <li>/trunk/res/res_jabber.c <span style="color: grey">(388689)</span></li>

 <li>/trunk/res/res_stasis.c <span style="color: grey">(388689)</span></li>

</ul>

<p><a href="https://reviewboard.asterisk.org/r/2540/diff/" style="margin-left: 3em;">View Diff</a></p>







  </td>
 </tr>
</table>




  </div>
 </body>
</html>