gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r20797 - in gnunet/src/gns: . testdb


From: gnunet
Subject: [GNUnet-SVN] r20797 - in gnunet/src/gns: . testdb
Date: Wed, 28 Mar 2012 13:12:19 +0200

Author: schanzen
Date: 2012-03-28 13:12:19 +0200 (Wed, 28 Mar 2012)
New Revision: 20797

Modified:
   gnunet/src/gns/gns_api.c
   gnunet/src/gns/gnunet-service-gns_resolver.c
   gnunet/src/gns/gnunet-service-gns_resolver.h
   gnunet/src/gns/test_gns_max_queries.c
   gnunet/src/gns/testdb/sqlite-alice.db
   gnunet/src/gns/testdb/sqlite-bob.db
   gnunet/src/gns/testdb/sqlite-dave.db
Log:
-fixes, cleanup


Modified: gnunet/src/gns/gns_api.c
===================================================================
--- gnunet/src/gns/gns_api.c    2012-03-28 10:03:22 UTC (rev 20796)
+++ gnunet/src/gns/gns_api.c    2012-03-28 11:12:19 UTC (rev 20797)
@@ -686,7 +686,7 @@
 
   memcpy(&lookup_msg[1], name, strlen(name));
 
-  GNUNET_CONTAINER_DLL_insert (handle->pending_head, handle->pending_tail,
+  GNUNET_CONTAINER_DLL_insert_tail (handle->pending_head, handle->pending_tail,
                                pending);
   
   process_pending_messages (handle);
@@ -743,7 +743,7 @@
 
   memcpy(&shorten_msg[1], name, strlen(name));
 
-  GNUNET_CONTAINER_DLL_insert (handle->pending_head, handle->pending_tail,
+  GNUNET_CONTAINER_DLL_insert_tail (handle->pending_head, handle->pending_tail,
                                pending);
   
   process_pending_messages (handle);
@@ -800,7 +800,7 @@
 
   memcpy(&get_auth_msg[1], name, strlen(name));
 
-  GNUNET_CONTAINER_DLL_insert (handle->pending_head, handle->pending_tail,
+  GNUNET_CONTAINER_DLL_insert_tail (handle->pending_head, handle->pending_tail,
                                pending);
   
   process_pending_messages (handle);

Modified: gnunet/src/gns/gnunet-service-gns_resolver.c
===================================================================
--- gnunet/src/gns/gnunet-service-gns_resolver.c        2012-03-28 10:03:22 UTC 
(rev 20796)
+++ gnunet/src/gns/gnunet-service-gns_resolver.c        2012-03-28 11:12:19 UTC 
(rev 20797)
@@ -489,7 +489,7 @@
   ResolverCleanupContinuation cont = cls;
   
   GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
-             "GNS_CLEANUP-%d: Terminating background lookup for %s\n",
+             "GNS_CLEANUP-%llu: Terminating background lookup for %s\n",
              rh->id, rh->name);
   GNUNET_DHT_get_stop(rh->get_handle);
   rh->get_handle = NULL;
@@ -914,12 +914,12 @@
   
   if (name != NULL)
   {
-    rh->status |= EXISTS;
+    rh->status |= RSL_RECORD_EXISTS;
   }
   
   if (remaining_time.rel_value == 0)
   {
-    rh->status |= EXPIRED;
+    rh->status |= RSL_RECORD_EXPIRED;
   }
   
   if (rd_count == 0)
@@ -1049,7 +1049,7 @@
          "GNS_PHASE_DELEGATE_DHT-%llu: dht lookup for query %s (%ds)timed 
out.\n",
          rh->id, rh->authority_name, rh->timeout.rel_value);
 
-  rh->status |= TIMED_OUT;
+  rh->status |= RSL_TIMED_OUT;
 
   rh->timeout_task = GNUNET_SCHEDULER_NO_TASK;
   
@@ -1495,7 +1495,7 @@
     
     /**
      * There are 4 conditions that have to met for us to consult the DHT:
-     * 1. The entry in the DHT is EXPIRED AND
+     * 1. The entry in the DHT is RSL_RECORD_EXPIRED AND
      * 2. No entry in the NS existed AND
      * 3. The zone queried is not the local resolver's zone AND
      * 4. The name that was looked up is '+'
@@ -1503,7 +1503,7 @@
      *    the DHT for the authority in the authority lookup phase (and thus
      *    would already have an entry in the NS for the record)
      */
-    if (rh->status & (EXPIRED | !EXISTS) &&
+    if (rh->status & (RSL_RECORD_EXPIRED | !RSL_RECORD_EXISTS) &&
         GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone,
                                      &local_zone) &&
         (strcmp(rh->name, "+") == 0))
@@ -1792,9 +1792,9 @@
    * and exists
    * or we are authority
    **/
-  if ((rh->status & (EXISTS | !EXPIRED)) ||
-      !GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone,
-                             &rh->authority_chain_tail->zone))
+  if (((rh->status & RSL_RECORD_EXISTS) && (rh->status & !RSL_RECORD_EXPIRED))
+      || !GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone,
+                                       &local_zone))
   {
     if (is_canonical(rh->name))
     {
@@ -1869,12 +1869,12 @@
   
   if (name != NULL)
   {
-    rh->status |= EXISTS;
+    rh->status |= RSL_RECORD_EXISTS;
   }
   
   if (remaining_time.rel_value == 0)
   {
-    rh->status |= EXPIRED;
+    rh->status |= RSL_RECORD_EXPIRED;
   }
   
   /**

Modified: gnunet/src/gns/gnunet-service-gns_resolver.h
===================================================================
--- gnunet/src/gns/gnunet-service-gns_resolver.h        2012-03-28 10:03:22 UTC 
(rev 20796)
+++ gnunet/src/gns/gnunet-service-gns_resolver.h        2012-03-28 11:12:19 UTC 
(rev 20797)
@@ -41,11 +41,11 @@
 typedef void (*ResolverCleanupContinuation) (void);
 
 /**
- * processor for a resultion result
+ * processor for a record lookup result
  *
  * @param cls the closure
  * @param rd_count number of results
- * @param rd resukt data
+ * @param rd result data
  */
 typedef void (*RecordLookupProcessor) (void *cls,
                                   uint32_t rd_count,
@@ -70,7 +70,7 @@
 typedef void (*GetAuthorityResultProcessor) (void *cls, const char* name);
 
 /**
- * processor for a resultion result
+ * processor for a resolution result
  *
  * @param cls the closure
  * @param rh the resolution handle
@@ -84,19 +84,27 @@
 
 
 /**
- * Resoltion status indicator
- * EXISTS: the name to lookup exists
- * EXPIRED: the name in the record expired
+ * Resolution status indicator
+ * RSL_RECORD_EXISTS: the name to lookup exists
+ * RSL_RECORD_EXPIRED: the name in the record expired
+ * RSL_TIMED_OUT: resolution timed out
  */
 enum ResolutionStatus
 {
-  EXISTS = 1,
-  EXPIRED = 2,
-  TIMED_OUT = 4
+  RSL_RECORD_EXISTS = 1,
+  RSL_RECORD_EXPIRED = 2,
+  RSL_TIMED_OUT = 4
 };
 
 /**
  * Handle to a currenty pending resolution
+ * a ResolverHandle is passed to, for example
+ * resolve_record_ns to resolve a record in the namestore.
+ * On result (positive or negative) the ResolutionResultProcessor
+ * is called.
+ * If a timeout is set timeout_cont will be called.
+ * If no timeout is set (ie timeout forever) then background resolutions
+ * might be triggered.
  */
 struct ResolverHandle
 {
@@ -112,12 +120,6 @@
   /* the name of the authoritative zone to query */
   char authority_name[MAX_DNS_LABEL_LENGTH];
 
-  /**
-   * we have an authority in namestore that
-   * may be able to resolve
-   */
-  int authority_found;
-
   /* a handle for dht lookups. should be NULL if no lookups are in progress */
   struct GNUNET_DHT_GetHandle *get_handle;
 
@@ -193,14 +195,11 @@
  */
 struct NameShortenHandle
 {
-
-
   /* Method to call on shorten result */
   ShortenResultProcessor proc;
 
   /* closure to pass to proc */
   void* proc_cls;
-
 };
 
 /**
@@ -208,7 +207,6 @@
  */
 struct GetNameAuthorityHandle
 {
-  
   /* the name to look up authority for */
   char name[MAX_DNS_NAME_LENGTH];
   
@@ -217,7 +215,6 @@
 
   /* closure to pass to proc */
   void* proc_cls;
-
 };
 
 /**
@@ -276,7 +273,7 @@
 
 /**
  * Lookup of a record in a specific zone
- * calls lookup result processor on result
+ * calls RecordLookupProcessor on result or timeout
  *
  * @param zone the root zone
  * @param record_type the record type to look up

Modified: gnunet/src/gns/test_gns_max_queries.c
===================================================================
--- gnunet/src/gns/test_gns_max_queries.c       2012-03-28 10:03:22 UTC (rev 
20796)
+++ gnunet/src/gns/test_gns_max_queries.c       2012-03-28 11:12:19 UTC (rev 
20797)
@@ -169,18 +169,19 @@
     ok = 2;
   }
 
-  GNUNET_GNS_lookup(gns_handle, TEST_DOMAIN, GNUNET_GNS_RECORD_TYPE_A,
-                    &on_lookup_result, TEST_DOMAIN);
 
   /* Now lookup some non existing records */
   for (i=0; i<max_parallel_lookups+TEST_ADDITIONAL_LOOKUPS; i++)
   {
     GNUNET_snprintf(lookup_name,
                     MAX_DNS_NAME_LENGTH,
-                    "doesnotexist-%d.bob.gnunet", i);
+                    "www.doesnotexist-%d.bob.gnunet", i);
     GNUNET_GNS_lookup(gns_handle, lookup_name, GNUNET_GNS_RECORD_TYPE_A,
                       &on_lookup_result_dummy, NULL);
   }
+
+  GNUNET_GNS_lookup(gns_handle, TEST_DOMAIN, GNUNET_GNS_RECORD_TYPE_A,
+                    &on_lookup_result, TEST_DOMAIN);
 }
 
 

Modified: gnunet/src/gns/testdb/sqlite-alice.db
===================================================================
(Binary files differ)

Modified: gnunet/src/gns/testdb/sqlite-bob.db
===================================================================
(Binary files differ)

Modified: gnunet/src/gns/testdb/sqlite-dave.db
===================================================================
(Binary files differ)




reply via email to

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