<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hello,<br>
<br>
On 1/26/10 8:10 PM, Marius Zbihlei wrote:
<blockquote
 cite="mid:E2A35B0687F8DE46B69CE1FB9433CF24CD9063@WEBEXCHANGE.webde.local"
 type="cite">
  <meta http-equiv="Content-Type"
 content="text/html; charset=ISO-8859-1">
  <meta name="Generator"
 content="MS Exchange Server version 6.5.7654.12">
  <title>RE: [Kamailio-Users] core:proxy.c problem</title>
<!-- Converted from text/plain format -->
  <p><font size="2">Hello,<br>
Sorry again for top-posting, web client Agrrr....<br>
  <br>
I will push the patch to upstream tomorrow, if nobody has anything
against it.</font></p>
</blockquote>
<br>
I would wait a bit, not sure what are the exact changes, but I prefer
to have most of updates from 3.0 branches integrated first, to avoid
conflicts (Andrei just resumed the process). Besides that the function
is pretty used across the code, should be reviewed carefully.<br>
<br>
Thanks,<br>
Daniel<br>
<br>
<blockquote
 cite="mid:E2A35B0687F8DE46B69CE1FB9433CF24CD9063@WEBEXCHANGE.webde.local"
 type="cite">
  <p><font size="2"> Along with the proxy caching functionality that I
described in the previous mail today, they are for now in a&nbsp; single
patch, so i need a little time to break it in two, and only commit this
atm.<br>
  <br>
I am for a deep copy of the name. My reason is that also the
mk_shm_proxy funtion requires (even if documentation says nothing)&nbsp; the
name parameter to point to something in shared memory(as to be
addressable by other processes)<br>
  <br>
As I said, I think that the proxy object abstractization should have
ownership of all it's members.<br>
  <br>
  <br>
Greetings<br>
Marius<br>
  <br>
-----Original Message-----<br>
From: Daniel-Constantin Mierla [<a moz-do-not-send="true"
 href="mailto:miconda@gmail.com">mailto:miconda@gmail.com</a>]<br>
Sent: Tue 1/26/2010 7:11 PM<br>
To: Marius Zbihlei<br>
Cc: <a class="moz-txt-link-abbreviated" href="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</a>; <a class="moz-txt-link-abbreviated" href="mailto:users@lists.kamailio.org">users@lists.kamailio.org</a><br>
Subject: Re: [Kamailio-Users] core:proxy.c problem<br>
  <br>
Hello,<br>
  <br>
On 1/26/10 5:02 PM, marius zbihlei wrote:<br>
&gt; Hello,<br>
&gt;<br>
&gt; There seems to be a design problem in proxy.c mk_proxy(str* name,<br>
&gt; unsigned short port, unsigned short proto,<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int is_sips) function. The purpose of this function is to<br>
&gt; create a proxy and return a pointer to the<br>
&gt; created structure.<br>
&gt;<br>
&gt; The issue arises from the fact that the name (type struct str)
member<br>
&gt; of the proxy structure is not deep copied from the given<br>
&gt; parameters(refer to the str* name ) (the hostent structure is
instead<br>
&gt; deep copied). This isn't a problem for now but I have worked on a<br>
&gt; small patch that caches proxies (using add_proxy() and
find_proxy())<br>
&gt; and ,because of this shallow copy, things are broken.<br>
  <br>
how is it going to be? Each structure will have a reference counter to<br>
ensure is not deleted while still in use? Is the structure in shm?<br>
  <br>
  <br>
&gt;<br>
&gt; I said that this is a design problem because we can let the shallow<br>
&gt; copy happen (performance is better), and when needed the caller
should<br>
&gt; provide a buffer that doesn't change (let him do the copy instead).<br>
&gt; This is not clearly documented but done from<br>
&gt; /modules(_k)/utils/conf.c. But it this way we may have a memory
leak<br>
&gt; when the proxy is deallocated, because I doubt that the caller
keeps<br>
&gt; track of the allocated buffers(the code in proxy.c doesn't take<br>
&gt; ownership of the given pointer).<br>
&gt;<br>
&gt; This affects functions mk_proxy and mk_shm_proxy in both
kamailio(1.5<br>
&gt; to speak of) and sip-router.<br>
&gt;<br>
&gt; I have created a patch that also does a deep copy of the name, thus<br>
&gt; removing the need for the caller to bother about the lifetime of
the<br>
&gt; name buffer.<br>
&gt;<br>
&gt; Any ideas?!<br>
Seems ok for me, maybe Andrei can comment better in relation with tm and<br>
other core functions.<br>
  <br>
Did you (intend to) attach the patch or you just mentioned it.<br>
  <br>
Cheers,<br>
Daniel<br>
  <br>
--<br>
Daniel-Constantin Mierla<br>
* <a moz-do-not-send="true" href="http://www.asipto.com/">http://www.asipto.com/</a><br>
  <br>
  <br>
  </font>
  </p>
  <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Kamailio (OpenSER) - Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.kamailio.org">Users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="http://lists.kamailio.org/cgi-bin/mailman/listinfo/users">http://lists.kamailio.org/cgi-bin/mailman/listinfo/users</a>
<a class="moz-txt-link-freetext" href="http://lists.openser-project.org/cgi-bin/mailman/listinfo/users">http://lists.openser-project.org/cgi-bin/mailman/listinfo/users</a></pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
* <a class="moz-txt-link-freetext" href="http://www.asipto.com/">http://www.asipto.com/</a>
</pre>
</body>
</html>