gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r22431 - gnunet/src/gns


From: gnunet
Subject: [GNUnet-SVN] r22431 - gnunet/src/gns
Date: Mon, 2 Jul 2012 14:39:04 +0200

Author: grothoff
Date: 2012-07-02 14:39:04 +0200 (Mon, 02 Jul 2012)
New Revision: 22431

Modified:
   gnunet/src/gns/gnunet-service-gns_resolver.c
   gnunet/src/gns/gnunet-service-gns_resolver.h
Log:
-be lazy about connecting to VPN

Modified: gnunet/src/gns/gnunet-service-gns_resolver.c
===================================================================
--- gnunet/src/gns/gnunet-service-gns_resolver.c        2012-07-02 12:25:52 UTC 
(rev 22430)
+++ gnunet/src/gns/gnunet-service-gns_resolver.c        2012-07-02 12:39:04 UTC 
(rev 22431)
@@ -132,6 +132,11 @@
 static struct ResolverHandle *nah_tail;
 
 /**
+ * Global configuration.
+ */
+static const struct GNUNET_CONFIGURATION_Handle *cfg;
+
+/**
  * a resolution identifier pool variable
  * FIXME overflow?
  * This is a non critical identifier useful for debugging
@@ -719,20 +724,21 @@
  * @param nh the namestore handle
  * @param dh the dht handle
  * @param lz the local zone's hash
- * @param cfg configuration handle
+ * @param c configuration handle
  * @param max_bg_queries maximum number of parallel background queries in dht
  * @param ignore_pending ignore records that still require user confirmation
  *        on lookup
  * @return GNUNET_OK on success
  */
 int
-gns_resolver_init(struct GNUNET_NAMESTORE_Handle *nh,
-                  struct GNUNET_DHT_Handle *dh,
-                  struct GNUNET_CRYPTO_ShortHashCode lz,
-                  const struct GNUNET_CONFIGURATION_Handle *cfg,
-                  unsigned long long max_bg_queries,
-                  int ignore_pending)
+gns_resolver_init (struct GNUNET_NAMESTORE_Handle *nh,
+                  struct GNUNET_DHT_Handle *dh,
+                  struct GNUNET_CRYPTO_ShortHashCode lz,
+                  const struct GNUNET_CONFIGURATION_Handle *c,
+                  unsigned long long max_bg_queries,
+                  int ignore_pending)
 {
+  cfg = c;
   namestore_handle = nh;
   dht_handle = dh;
   local_zone = lz;
@@ -756,18 +762,7 @@
   
   GNUNET_RESOLVER_connect (cfg);
   
-  if (NULL == vpn_handle)
-  {
-    vpn_handle = GNUNET_VPN_connect (cfg);
-    if (NULL == vpn_handle)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "GNS_PHASE_INIT: Error connecting to VPN!\n");
 
-      return GNUNET_SYSERR;
-    }
-  }
-
   if ((namestore_handle != NULL) && (dht_handle != NULL))
   {
     return GNUNET_OK;
@@ -2045,14 +2040,27 @@
     af = AF_INET6;
   
   //FIXME timeout??
+  if (NULL == vpn_handle)
+  {
+    vpn_handle = GNUNET_VPN_connect (cfg);
+    if (NULL == vpn_handle)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "GNS_PHASE_INIT: Error connecting to VPN!\n");
+      finish_lookup (rh, rh->proc_cls, 0, NULL);
+      return;
+    }
+  }
+
+
   rh->vpn_handle = GNUNET_VPN_redirect_to_peer (vpn_handle,
-                                          af, ntohs (vpn->proto),
-                                          (struct GNUNET_PeerIdentity 
*)&vpn->peer,
-                                          &serv_desc,
-                                          GNUNET_NO, //nac
-                                          GNUNET_TIME_UNIT_FOREVER_ABS, //FIXME
-                                          &process_record_result_vpn,
-                                          rh);
+                                               af, ntohs (vpn->proto),
+                                               (struct GNUNET_PeerIdentity 
*)&vpn->peer,
+                                               &serv_desc,
+                                               GNUNET_NO, //nac
+                                               GNUNET_TIME_UNIT_FOREVER_ABS, 
//FIXME
+                                               &process_record_result_vpn,
+                                               rh);
 
 }
 

Modified: gnunet/src/gns/gnunet-service-gns_resolver.h
===================================================================
--- gnunet/src/gns/gnunet-service-gns_resolver.h        2012-07-02 12:25:52 UTC 
(rev 22430)
+++ gnunet/src/gns/gnunet-service-gns_resolver.h        2012-07-02 12:39:04 UTC 
(rev 22431)
@@ -350,7 +350,7 @@
  * @param nh handle to the namestore
  * @param dh handle to the dht
  * @param lz the local zone
- * @param cfg configuration handle
+ * @param c configuration handle
  * @param max_bg_queries maximum amount of background queries
  * @param ignore_pending ignore records that still require user confirmation
  *        on lookup
@@ -360,7 +360,7 @@
 gns_resolver_init(struct GNUNET_NAMESTORE_Handle *nh,
                   struct GNUNET_DHT_Handle *dh,
                   struct GNUNET_CRYPTO_ShortHashCode lz,
-                  const struct GNUNET_CONFIGURATION_Handle *cfg,
+                  const struct GNUNET_CONFIGURATION_Handle *c,
                   unsigned long long max_bg_queries,
                   int ignore_pending);
 




reply via email to

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