gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r5594 - GNUnet/src/util/network


From: gnunet
Subject: [GNUnet-SVN] r5594 - GNUnet/src/util/network
Date: Wed, 5 Sep 2007 05:47:06 -0600 (MDT)

Author: grothoff
Date: 2007-09-05 05:47:05 -0600 (Wed, 05 Sep 2007)
New Revision: 5594

Modified:
   GNUnet/src/util/network/dns.c
Log:
lazy ADNS initialization (not needed for gnunetd)

Modified: GNUnet/src/util/network/dns.c
===================================================================
--- GNUnet/src/util/network/dns.c       2007-09-05 11:41:03 UTC (rev 5593)
+++ GNUnet/src/util/network/dns.c       2007-09-05 11:47:05 UTC (rev 5594)
@@ -53,6 +53,8 @@
 static struct MUTEX *lock;
 
 #if HAVE_ADNS
+static int a_init;
+
 static adns_state a_state;
 #endif
 
@@ -65,6 +67,11 @@
   struct IPCache *rec;
   int reti;
 
+  if (a_init == 0)
+    {
+      a_init = 1;
+      adns_init (&a_state, adns_if_noerrprint, NULL);
+    }
   if (cache->posted == NO)
     {
       ret = adns_submit_reverse (a_state, cache->sa, adns_r_ptr,
@@ -269,9 +276,6 @@
 void __attribute__ ((constructor)) gnunet_dns_ltdl_init ()
 {
   lock = MUTEX_CREATE (YES);
-#if HAVE_ADNS
-  adns_init (&a_state, adns_if_noerrprint, NULL);
-#endif
 }
 
 void __attribute__ ((destructor)) gnunet_dns_ltdl_fini ()
@@ -294,6 +298,10 @@
       head = pos;
     }
 #if HAVE_ADNS
-  adns_finish (a_state);
+  if (a_init != 0)
+    {
+      a_init = 0;
+      adns_finish (a_state);
+    }
 #endif
 }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]