[OpenSIPS-Devel] [opensips] load_balancer module enhancements (#345)
Sergey KHripchenko
notifications at github.com
Tue Jan 27 14:08:39 CET 2015
@bogdan-iancu, I did a small review.
I have a doubts about this one block of code in `lb_route()` function:
```c++
/* save state - res */
/* iterate AVPs once and delete old resources */
destroy_avps(0, res_avp_name, 1 /*all*/);
/* add new resources */
for( i=0 ; i<res_cur_n ; i++ ) {
res_val.s = res_cur[i]->name;
if( add_avp(AVP_VAL_STR, res_avp_name, res_val) != 0 )
LM_ERR("failed to add RES AVP\n");
}
```
Previously we searched through AVPs and delete old/add new.
This way we could be sure that no unnecessary memory allocations are made.
Our usual scenario is a continuous call of `lb_next()` with cached/unchanged resources list.
So we usually expect no memory allocations when handling resources list AVPs during subsequent `lb_next()` calls.
This is not true in your version of code.
What do you think?
---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/345#issuecomment-71644836
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/devel/attachments/20150127/6fe12084/attachment.htm>
More information about the Devel
mailing list