<p style="white-space: pre-wrap; word-wrap: break-word;">current patch set has more holes than a swiss cheese, but I have a better idea...</p><p>Patch set 5:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #ffd4d4;">Code-Review -1</span></p><p><a href="https://gerrit.osmocom.org/13479">View Change</a></p><p>6 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/#/c/13479/5/src/hlr_ussd.c">File src/hlr_ussd.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/13479/5/src/hlr_ussd.c@175">Patch Set #5, Line 175:</a> <code style="font-family:monospace,monospace">  struct osmo_timer_list subscr_timeout;</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">let's take this ss->subscr from the top. I had a very simple idea in mind, but it wasn't thought through properly, confused you guys and has now mutated to a timeouted cache of stale data... Let's drop this again.</p><p style="white-space: pre-wrap; word-wrap: break-word;">Here is a probably much better approach:</p><ul><li>store only the MSC name in ss->.</li></ul><ul><li>For all MO USSD sessions, store the originating MSC's vlr_name in ss-> on the first message coming in from the MSC/VLR. Whatever happens, always route back to that MSC name: all errors and replies. This should then prevent all additional database lookups.</li></ul><ul><li>For MT USSD sessions, there will be no MSC's vlr_name stored in ss-> at first. Do a db lookup for routing to the right vlr_name, store it in ss->vlr_name.</li></ul><p style="white-space: pre-wrap; word-wrap: break-word;">Hence we will hit the db for routing at most once per ss_session, will not keep any other stale subscr state, don't need timers.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/13479/5/src/hlr_ussd.c@251">Patch Set #5, Line 251:</a> <code style="font-family:monospace,monospace">return -EINVAL;</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">memleak: msg was allocated dynamically, so here you need to free it.</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">thx</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/13479/5/src/hlr_ussd.c@254">Patch Set #5, Line 254:</a> <code style="font-family:monospace,monospace">           osmo_timer_schedule(&ss->subscr_timeout, OSMO_SESSION_SUBSCRIBER_CACHE_TIMEOUT, 0);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">(this was not even assigning anything to ss->subscr)</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/13479/5/src/hlr_ussd.c@263">Patch Set #5, Line 263:</a> <code style="font-family:monospace,monospace">USSD</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">'SS/USSD' would be more correct, as we would also deal with "structured" Supplementary Services some […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">(ack, I have no good idea about naming here)</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/13479/5/src/hlr_ussd.c@286">Patch Set #5, Line 286:</a> <code style="font-family:monospace,monospace">resp_msg = gsm0480_msgb_alloc_name(__func__);</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">So here we allocate a message buffer on heap... […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">agree, but separate patch.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/13479/5/src/hlr_ussd.c@343">Patch Set #5, Line 343:</a> <code style="font-family:monospace,monospace">           osmo_timer_schedule(&ss->subscr_timeout, OSMO_SESSION_SUBSCRIBER_CACHE_TIMEOUT, 0);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">(setting ss->subscr to point at local struct subscr becomes invalid memory as soon as the function exits)</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.osmocom.org/13479">change 13479</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.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.osmocom.org/13479"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-hlr </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: comment </div>
<div style="display:none"> Gerrit-Change-Id: I18067bfadd33a6bc59a9ee336b6937313826fce3 </div>
<div style="display:none"> Gerrit-Change-Number: 13479 </div>
<div style="display:none"> Gerrit-PatchSet: 5 </div>
<div style="display:none"> Gerrit-Owner: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder (1000002) </div>
<div style="display:none"> Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Pau Espin Pedrol <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Vadim Yanitskiy <axilirator@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: osmith <osmith@sysmocom.de> </div>
<div style="display:none"> Gerrit-Comment-Date: Sat, 06 Apr 2019 15:14:56 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-HasLabels: Yes </div>