[OpenSIPS-Users] Proposed change to cachedb

Vlad Paiu vladpaiu at opensips.org
Wed Jul 23 16:32:36 CEST 2014


Hello Brett,

What OpenSIPS version are you using ?

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.

Best Regards,

Vlad Paiu
OpenSIPS Developer
http://www.opensips-solutions.com

On 23.07.2014 17:18, Brett Nemeroff wrote:
> Hey All,
>
> Using memcached..
>
> 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 cachedb.c because we do this at the end 
> of cachedb_fetch:
>
> return cde->cdb_func.get(con,attr,val)<0?-1:1;
>
> 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.
>
> So I changed that one return line to look more like this:
>
>         res = cde->cdb_func.get(con,attr,val);
>         if (res < 0) {
>           return res;
>         } else {
>           return 1;
>         }
>
> 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.
>
> Thoughts?
>
> Thanks,
> Brett
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20140723/07977f49/attachment.htm>


More information about the Users mailing list