<ul>
<li>simplify general implementation</li>
<li>avoid deadlock due to a process trying to acquire same lock twice</li>
</ul>


<h4>Pre-Submission Checklist</h4>



<ul>
<li>[x ] Commit message has the format required by CONTRIBUTING guide</li>
<li>[ x] Commits are split per component (core, individual modules, libs, utils, ...)</li>
<li>[ x] Each component has a single commit (if not, squash them into one commit)</li>
<li>[ x] No commits to README files for modules (changes must be done to docbook files<br>
in <code>doc/</code> subfolder, the README file is autogenerated)</li>
</ul>
<h4>Type Of Change</h4>
<ul class="contains-task-list">
<li>[ x] Small bug fix (non-breaking change which fixes an issue)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> New feature (non-breaking change which adds new functionality)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Breaking change (fix or feature that would change existing functionality)</li>
</ul>
<h4>Checklist:</h4>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> PR should be backported to stable branches</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Tested changes locally</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Related to issue #XXXX (replace XXXX with an open issue number)</li>
</ul>
<h4>Description</h4>

<p>On a timer, checking the availability of the master db used for writing and setting a status variable accordingly. In case the mdb_availability_control option is set, this status variable is consulted with no synchronization by each process when trying to do a write to the master db. As error mitigation, in case the per process handle associated with master db is NULL, p_usrlock recreates it. In case the per process handle is not NULL, Kamailio will try to recreate a broken connection by itself.</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/kamailio/kamailio/pull/2399'>https://github.com/kamailio/kamailio/pull/2399</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>p_usrloc: reworking mdb_availability_control</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/2399/files#diff-e9c66e16c89452a263cad0776879dd14">src/modules/p_usrloc/p_usrloc_mod.c</a>
    (23)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/2399/files#diff-0956ae7a27c2319def6edb953630a929">src/modules/p_usrloc/p_usrloc_mod.h</a>
    (6)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/2399/files#diff-40a42775d07427dd25af18cad51f41c4">src/modules/p_usrloc/ul_db.c</a>
    (70)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/2399/files#diff-6781575c4c9f10ee7847e5ae788c9eb7">src/modules/p_usrloc/ul_db_watch.c</a>
    (15)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/2399/files#diff-37734d49578e509502be84acad92e4d8">src/modules/p_usrloc/ul_db_watch.h</a>
    (2)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/kamailio/kamailio/pull/2399.patch'>https://github.com/kamailio/kamailio/pull/2399.patch</a></li>
  <li><a href='https://github.com/kamailio/kamailio/pull/2399.diff'>https://github.com/kamailio/kamailio/pull/2399.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/pull/2399">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZPHJSUAXFXVVJJZPP3R3QOZFANCNFSM4OZKGEUQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZIZVS3NFXX2QWLXYPTR3QOZFA5CNFSM4OZKGEU2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4JZAZKAA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/pull/2399",
"url": "https://github.com/kamailio/kamailio/pull/2399",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>