gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r20559 - gnunet/src/gns
Date: Fri, 16 Mar 2012 09:39:00 +0100

Author: schanzen
Date: 2012-03-16 09:39:00 +0100 (Fri, 16 Mar 2012)
New Revision: 20559

Modified:
   gnunet/src/gns/gnunet-service-gns.c
   gnunet/src/gns/gnunet-service-gns_resolver.c
   gnunet/src/gns/gnunet-service-gns_resolver.h
   gnunet/src/gns/test_gns_dht_delegated_lookup.c
   gnunet/src/gns/test_gns_simple_delegated_lookup.c
   gnunet/src/gns/test_gns_simple_lookup.c
   gnunet/src/gns/test_gns_simple_shorten.c
Log:
-fixes


Modified: gnunet/src/gns/gnunet-service-gns.c
===================================================================
--- gnunet/src/gns/gnunet-service-gns.c 2012-03-16 08:07:55 UTC (rev 20558)
+++ gnunet/src/gns/gnunet-service-gns.c 2012-03-16 08:39:00 UTC (rev 20559)
@@ -108,7 +108,7 @@
 /**
  * Our handle to the DHT
  */
-struct GNUNET_DHT_Handle *dht_handle;
+static struct GNUNET_DHT_Handle *dht_handle;
 
 /**
  * Our zone's private key
@@ -760,23 +760,6 @@
                      &zone_hash);
   GNUNET_free(keyfile);
   
-
-  if (GNUNET_YES ==
-      GNUNET_CONFIGURATION_get_value_yesno (c, "gns",
-                                            "HIJACK_DNS"))
-  {
-    GNUNET_log(GNUNET_ERROR_TYPE_INFO,
-               "DNS hijacking enabled... connecting to service.\n");
-
-    if (gns_interceptor_init(zone_hash, c) == GNUNET_SYSERR)
-    {
-      GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
-               "Failed to enable the dns interceptor!\n");
-    }
-  }
-
-  
-
   /**
    * handle to our local namestore
    */
@@ -801,6 +784,28 @@
     GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Could not connect to DHT!\n");
   }
 
+  if (gns_resolver_init(namestore_handle, dht_handle) == GNUNET_SYSERR)
+  {
+    GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
+               "Unable to initialize resolver!\n");
+    GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
+    return;
+  }
+
+  if (GNUNET_YES ==
+      GNUNET_CONFIGURATION_get_value_yesno (c, "gns",
+                                            "HIJACK_DNS"))
+  {
+    GNUNET_log(GNUNET_ERROR_TYPE_INFO,
+               "DNS hijacking enabled... connecting to service.\n");
+
+    if (gns_interceptor_init(zone_hash, c) == GNUNET_SYSERR)
+    {
+      GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
+               "Failed to enable the dns interceptor!\n");
+    }
+  }
+
   //put_some_records(); //FIXME for testing
   
   /**

Modified: gnunet/src/gns/gnunet-service-gns_resolver.c
===================================================================
--- gnunet/src/gns/gnunet-service-gns_resolver.c        2012-03-16 08:07:55 UTC 
(rev 20558)
+++ gnunet/src/gns/gnunet-service-gns_resolver.c        2012-03-16 08:39:00 UTC 
(rev 20559)
@@ -47,23 +47,30 @@
 /**
  * Our handle to the namestore service
  */
-struct GNUNET_NAMESTORE_Handle *namestore_handle;
+static struct GNUNET_NAMESTORE_Handle *namestore_handle;
 
 /**
  * Resolver handle to the dht
  */
-struct GNUNET_DHT_Handle *dht_handle;
+static struct GNUNET_DHT_Handle *dht_handle;
 
 /**
- * Connects resolver to the dht
- *
-static void
-connect_to_dht()
+ * Initialize the resolver
+ */
+int
+gns_resolver_init(struct GNUNET_NAMESTORE_Handle *nh,
+                  struct GNUNET_DHT_Handle *dh)
 {
-  //FIXME
+  namestore_handle = nh;
+  dht_handle = dh;
+  if ((namestore_handle != NULL) && (dht_handle != NULL))
+  {
+    return GNUNET_OK;
+  }
+  return GNUNET_SYSERR;
 }
-*/
 
+
 /**
  * Helper function to free resolver handle
  *
@@ -274,7 +281,7 @@
   GNUNET_HashCode lookup_key;
   struct GNUNET_CRYPTO_HashAsciiEncoded lookup_key_string;
   struct RecordLookupHandle *rlh = (struct RecordLookupHandle *)rh->proc_cls;
-
+  
   GNUNET_CRYPTO_hash(rh->name, strlen(rh->name), &name_hash);
   GNUNET_CRYPTO_hash_xor(&name_hash, &rh->authority, &lookup_key);
   GNUNET_CRYPTO_hash_to_enc (&lookup_key, &lookup_key_string);
@@ -597,12 +604,11 @@
       resolve_delegation_dht(rh);
     return;
   }
-
+  
   /**
-   * should never get here unless false dht key/put
-   * block plugin should handle this
-   **/
-  GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "DHT authority lookup found no 
match!\n");
+   * No pkey but name exists
+   */
+  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "DHT authority lookup found no 
match!\n");
   rh->proc(rh->proc_cls, rh, 0, NULL);
 }
 
@@ -808,7 +814,7 @@
   uint32_t xquery;
   GNUNET_HashCode name_hash;
   GNUNET_HashCode lookup_key;
-
+  
   GNUNET_CRYPTO_hash(rh->authority_name,
                      strlen(rh->authority_name),
                      &name_hash);

Modified: gnunet/src/gns/gnunet-service-gns_resolver.h
===================================================================
--- gnunet/src/gns/gnunet-service-gns_resolver.h        2012-03-16 08:07:55 UTC 
(rev 20558)
+++ gnunet/src/gns/gnunet-service-gns_resolver.h        2012-03-16 08:39:00 UTC 
(rev 20559)
@@ -2,6 +2,7 @@
 #define GNS_RESOLVER_H
 
 #include "gns.h"
+#include "gnunet_dht_service.h"
 
 #define DHT_OPERATION_TIMEOUT  GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_SECONDS, 3)
 #define DHT_LOOKUP_TIMEOUT DHT_OPERATION_TIMEOUT
@@ -185,6 +186,16 @@
 
 };
 
+/**
+ * Initialize the resolver
+ *
+ * @param nh handle to the namestore
+ * @param dh handle to the dht
+ * @returns GNUNET_OK on success
+ */
+int
+gns_resolver_init(struct GNUNET_NAMESTORE_Handle *nh,
+                  struct GNUNET_DHT_Handle *dh);
 
 /**
  * Lookup of a record in a specific zone

Modified: gnunet/src/gns/test_gns_dht_delegated_lookup.c
===================================================================
--- gnunet/src/gns/test_gns_dht_delegated_lookup.c      2012-03-16 08:07:55 UTC 
(rev 20558)
+++ gnunet/src/gns/test_gns_dht_delegated_lookup.c      2012-03-16 08:39:00 UTC 
(rev 20559)
@@ -51,7 +51,7 @@
 #define VERBOSE GNUNET_YES
 
 /* Timeout for entire testcase */
-#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 10)
+#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 5)
 
 /* If number of peers not in config file, use this number */
 #define DEFAULT_NUM_PEERS 2

Modified: gnunet/src/gns/test_gns_simple_delegated_lookup.c
===================================================================
--- gnunet/src/gns/test_gns_simple_delegated_lookup.c   2012-03-16 08:07:55 UTC 
(rev 20558)
+++ gnunet/src/gns/test_gns_simple_delegated_lookup.c   2012-03-16 08:39:00 UTC 
(rev 20559)
@@ -50,7 +50,7 @@
 #define VERBOSE GNUNET_YES
 
 /* Timeout for entire testcase */
-#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 10)
+#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 5)
 
 /* If number of peers not in config file, use this number */
 #define DEFAULT_NUM_PEERS 2

Modified: gnunet/src/gns/test_gns_simple_lookup.c
===================================================================
--- gnunet/src/gns/test_gns_simple_lookup.c     2012-03-16 08:07:55 UTC (rev 
20558)
+++ gnunet/src/gns/test_gns_simple_lookup.c     2012-03-16 08:39:00 UTC (rev 
20559)
@@ -49,7 +49,7 @@
 #define VERBOSE GNUNET_YES
 
 /* Timeout for entire testcase */
-#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 10)
+#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 5)
 
 /* If number of peers not in config file, use this number */
 #define DEFAULT_NUM_PEERS 2

Modified: gnunet/src/gns/test_gns_simple_shorten.c
===================================================================
--- gnunet/src/gns/test_gns_simple_shorten.c    2012-03-16 08:07:55 UTC (rev 
20558)
+++ gnunet/src/gns/test_gns_simple_shorten.c    2012-03-16 08:39:00 UTC (rev 
20559)
@@ -36,7 +36,7 @@
 #define VERBOSE GNUNET_YES
 
 /* Timeout for entire testcase */
-#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 10)
+#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 5)
 
 /* If number of peers not in config file, use this number */
 #define DEFAULT_NUM_PEERS 2




reply via email to

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