[reSIProcate] DnsUtil.cxx

Gabriel Hege gabriel-mailinglists at gmx.de
Fri Aug 10 06:52:32 CDT 2012


Hi,

I also had a small problem with getLocalHostName() being called on 
application startup.

On my windows box my application shows the following log-message on startup:
INFO | 20120810-134241.423 |  | RESIP:DNS | 8048 | DnsUtil.cxx:156 | 
local hostname does not contain a domain part gabriel-laptop

This message can not be supppressed, since the corresponding code runs 
before the first line in main(). Making the localhostname a 
function-scope static as suggested by Byron solved the problem for me.


The patch is attached.


Best reagrds,
  gabriel



Am 06.08.2012 19:45, schrieb Byron Campen:
> Shouldn't this be a function-scope static anyway?
>
> Best regards,
> Byron Campen
> On Aug 6, 2012 9:22 AM, "Mike Hubbard" <mike.hubbard at ivr.com> wrote:
>
>> Hi Scott,****
>>
>> ** **
>>
>> The delay occurs every time I start the application.  It is the
>> getaddrinfo() API call that is causing the delay.****
>>
>> ** **
>>
>> Mike****
>>
>> ** **
>>
>> *From:* slgodin at gmail.com [mailto:slgodin at gmail.com] *On Behalf Of *Scott
>> Godin
>> *Sent:* Monday, August 06, 2012 9:17 AM
>> *To:* Mike Hubbard
>> *Cc:* resiprocate-devel at resiprocate.org
>> *Subject:* Re: [reSIProcate] DnsUtil.cxx****
>>
>> ** **
>>
>> Hi Mike,****
>>
>> ** **
>>
>> I have not noticed this problem on my systems (Windows 7 with IPv6
>> enabled).  I have some applications using resip statically and some using
>> it in a DLL.  Does the delay only happen when the machine is starting up,
>> or everytime you start your application?  Are you able to put a break point
>> in DnsUtil::getLocalHostName to see which API is causing the delay?   Note:
>>   getLocalHostName also calls initNetwork - which calls WSAStartup.****
>>
>> ** **
>>
>> Scott****
>>
>> On Sat, Aug 4, 2012 at 1:38 PM, Mike Hubbard <mike.hubbard at ivr.com> wrote:
>> ****
>>
>> Hello,****
>>
>>   ****
>>
>> I noticed in the most recent version of reciprocate that the routine
>> getLocalHostName() in the file DnsUtil.cxx has changed.  This routine seems
>> to be called by Helper.cxx in the following line of code:****
>>
>>   ****
>>
>> static Data localhostname = DnsUtil::getLocalHostName();****
>>
>>   ****
>>
>> This occurs when my .dll is loaded even  before the first line of the
>> main() routine is executed in the .exe.  On certain machines (mostly
>> Windows 7 with IPv6 enabled) the new call to getaddrinfo() is taking over 2
>> minutes to return.  Then my code breaks on the first line of the main()
>> function.****
>>
>>   ****
>>
>> Is anyone else experiencing a similar problem?  If so, do you have any
>> advice?****
>>
>>   ****
>>
>> Thanks in advance,****
>>
>> Mike****
>>
>>
>> _______________________________________________
>> resiprocate-devel mailing list
>> resiprocate-devel at resiprocate.org
>> https://list.resiprocate.org/mailman/listinfo/resiprocate-devel****
>>
>> ** **
>>
>> _______________________________________________
>> resiprocate-devel mailing list
>> resiprocate-devel at resiprocate.org
>> https://list.resiprocate.org/mailman/listinfo/resiprocate-devel
>>
>
>
>
> _______________________________________________
> resiprocate-devel mailing list
> resiprocate-devel at resiprocate.org
> https://list.resiprocate.org/mailman/listinfo/resiprocate-devel
>

-------------- next part --------------
Index: resip/stack/Helper.cxx
===================================================================
--- resip/stack/Helper.cxx	(revision 9866)
+++ resip/stack/Helper.cxx	(working copy)
@@ -645,10 +645,10 @@
 }
 
 
-static Data localhostname = DnsUtil::getLocalHostName();
 Data
 Helper::computeCallId()
 {
+   static Data localhostname = DnsUtil::getLocalHostName();
    Data hostAndSalt(localhostname + Random::getRandomHex(16));
 #ifndef USE_SSL // .bwc. None of this is neccessary if we're using openssl
 #if defined(__linux__) || defined(__APPLE__)


More information about the resiprocate-devel mailing list