<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Hello Brett,<br>
      <br>
      What OpenSIPS version are you using ?<br>
      <br>
      In the latest GIT for all maintained branches, the code was fixed
      to propagate the exact return from the module implementing the
      module connectivity, except for the 0 return code, which is
      converted to 1 ( success ) - done in order not to break the script
      execution.<br>
      <br>
      Best Regards,<br>
      <pre class="moz-signature" cols="72">Vlad Paiu
OpenSIPS Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a> </pre>
      On 23.07.2014 17:18, Brett Nemeroff wrote:<br>
    </div>
    <blockquote
cite="mid:CAPwC5wwwBfmDFdW0YGAAjngbA09xAwp=FQQ80ES3fA8MxmVUBQ@mail.gmail.com"
      type="cite">
      <div dir="ltr"><span
          style="font-family:arial,sans-serif;font-size:13px">Hey All,</span>
        <div style="font-family:arial,sans-serif;font-size:13px"><br>
        </div>
        <div style="font-family:arial,sans-serif;font-size:13px">Using
          memcached..</div>
        <div style="font-family:arial,sans-serif;font-size:13px"><br>
        </div>
        <div style="font-family:arial,sans-serif;font-size:13px">So I've
          noticed that while performing a cache_fetch I can't tell the
          difference between a cache failure and a NOT_FOUND. It seems
          the problem is actually in&nbsp;<span class=""
            style="background-color:rgb(255,255,204)">cachedb</span>.c
          because we do this at the end of&nbsp;cachedb_fetch:</div>
        <div style="font-family:arial,sans-serif;font-size:13px"><br>
        </div>
        <div style="font-family:arial,sans-serif;font-size:13px">&nbsp; &nbsp;
          return cde-&gt;cdb_func.get(con,attr,val)&lt;0?-1:1;</div>
        <div style="font-family:arial,sans-serif;font-size:13px">
          &nbsp;</div>
        <div style="font-family:arial,sans-serif;font-size:13px"><br>
        </div>
        <div style="font-family:arial,sans-serif;font-size:13px">So I
          read this to basically say to return -1 on any failure
          regardless of the failure code. This is probably because of
          the generalized nature of the cache interface and since each
          cache backend has it's own return codes. I get that, but that
          being said, I can't tell what the failure is and respond
          properly.</div>
        <div style="font-family:arial,sans-serif;font-size:13px"><br>
        </div>
        <div style="font-family:arial,sans-serif;font-size:13px">So I
          changed that one return line to look more like this:</div>
        <div style="font-family:arial,sans-serif;font-size:13px">
          <br>
        </div>
        <div style="font-family:arial,sans-serif;font-size:13px">
          <div>&nbsp; &nbsp; &nbsp; &nbsp; res = cde-&gt;cdb_func.get(con,attr,val);</div>
          <div>&nbsp; &nbsp; &nbsp; &nbsp; if (res &lt; 0) {</div>
          <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return res;</div>
          <div>&nbsp; &nbsp; &nbsp; &nbsp; } else {</div>
          <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return 1;</div>
          <div>&nbsp; &nbsp; &nbsp; &nbsp; }</div>
        </div>
        <div style="font-family:arial,sans-serif;font-size:13px"><br>
        </div>
        <div style="font-family:arial,sans-serif;font-size:13px">Is this
          acceptable? Will I run into problems I'm not thinking about?
          The only real problem I can see is that a specific error
          number on one cache backend might mean something different on
          another. Obviously the only way to really fix this would be to
          have each cache backend to match up it's own backend's reply
          codes to a set of generic opensips cache engine reply codes
          separately enumerated.</div>
        <div style="font-family:arial,sans-serif;font-size:13px"><br>
        </div>
        <div style="font-family:arial,sans-serif;font-size:13px">Thoughts?&nbsp;</div>
        <div style="font-family:arial,sans-serif;font-size:13px"><br>
        </div>
        <div style="font-family:arial,sans-serif;font-size:13px">
          Thanks,</div>
        <div style="font-family:arial,sans-serif;font-size:13px">Brett</div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>