gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r6318 - in GNUnet: . src/applications/dht/module src/applic


From: gnunet
Subject: [GNUnet-SVN] r6318 - in GNUnet: . src/applications/dht/module src/applications/fs/gap
Date: Sat, 16 Feb 2008 01:16:42 -0700 (MST)

Author: grothoff
Date: 2008-02-16 01:16:42 -0700 (Sat, 16 Feb 2008)
New Revision: 6318

Modified:
   GNUnet/src/applications/dht/module/table.c
   GNUnet/src/applications/fs/gap/fs.c
   GNUnet/src/applications/fs/gap/test_multi_results.c
   GNUnet/todo
Log:
fixes

Modified: GNUnet/src/applications/dht/module/table.c
===================================================================
--- GNUnet/src/applications/dht/module/table.c  2008-02-16 04:18:53 UTC (rev 
6317)
+++ GNUnet/src/applications/dht/module/table.c  2008-02-16 08:16:42 UTC (rev 
6318)
@@ -727,6 +727,27 @@
   return GNUNET_OK;
 }
 
+static void
+peer_disconnect_handler(const GNUNET_PeerIdentity * peer,
+                       void * unused)
+{
+  PeerBucket * bucket;
+  PeerInfo * info;
+
+  GNUNET_mutex_lock (lock);
+  bucket = findBucketFor(peer);
+  if (bucket != NULL)
+    {
+      info = findPeerEntryInBucket(bucket, peer);
+      if (info != NULL)
+       {
+         info->lastActivity = 0;
+         checkExpiration(bucket);
+       }
+    }
+  GNUNET_mutex_unlock (lock);
+}
+
 /**
  * Initialize table DHT component.
  *
@@ -769,6 +790,8 @@
   GNUNET_GE_ASSERT (coreAPI->ectx, pingpong != NULL);
   capi->registerHandler (GNUNET_P2P_PROTO_DHT_DISCOVERY, &handleDiscovery);
   capi->registerHandler (GNUNET_P2P_PROTO_DHT_ASK_HELLO, &handleAskHello);
+  capi->register_notify_peer_disconnect(&peer_disconnect_handler,
+                                       NULL);
   GNUNET_cron_add_job (coreAPI->cron,
                        &maintain_dht_job,
                        MAINTAIN_FREQUENCY, MAINTAIN_FREQUENCY, NULL);
@@ -786,6 +809,8 @@
   unsigned int i;
   unsigned int j;
 
+  coreAPI->unregister_notify_peer_disconnect(&peer_disconnect_handler,
+                                       NULL);
   coreAPI->unregisterHandler (GNUNET_P2P_PROTO_DHT_DISCOVERY,
                               &handleDiscovery);
   coreAPI->unregisterHandler (GNUNET_P2P_PROTO_DHT_ASK_HELLO,

Modified: GNUnet/src/applications/fs/gap/fs.c
===================================================================
--- GNUnet/src/applications/fs/gap/fs.c 2008-02-16 04:18:53 UTC (rev 6317)
+++ GNUnet/src/applications/fs/gap/fs.c 2008-02-16 08:16:42 UTC (rev 6318)
@@ -72,6 +72,8 @@
 
 static GNUNET_Datastore_ServiceAPI *datastore;
 
+static int active_migration;
+
 static int stat_gap_query_received;
 
 static int stat_gap_query_drop_busy;
@@ -682,7 +684,9 @@
                                                   &query,
                                                   expiration,
                                                   data_size, dblock);
-  if ((sender != NULL) && ((prio > 0) || (!test_load_too_high ())))
+  if ((sender != NULL) &&
+      (active_migration == GNUNET_YES) &&
+      ((prio > 0) || (!test_load_too_high ())))
     {
       /* consider storing in local datastore */
       value = GNUNET_malloc (data_size + sizeof (GNUNET_DatastoreValue));
@@ -733,7 +737,11 @@
                                                        &hardCPULimit)) || (-1 
== GNUNET_GC_get_configuration_value_number (coreAPI->cfg, "LOAD", 
"HARDUPLIMIT", 0, 999999999, 0,        /* 0 == no limit */
                                                                                
                                            &hardUpLimit)))
     return GNUNET_SYSERR;
-
+  active_migration 
+    = GNUNET_GC_get_configuration_value_yesno(coreAPI->cfg,
+                                             "FS",
+                                             "ACTIVEMIGRATION",
+                                             GNUNET_NO);
   stats = capi->request_service ("stats");
   if (stats != NULL)
     {

Modified: GNUnet/src/applications/fs/gap/test_multi_results.c
===================================================================
--- GNUnet/src/applications/fs/gap/test_multi_results.c 2008-02-16 04:18:53 UTC 
(rev 6317)
+++ GNUnet/src/applications/fs/gap/test_multi_results.c 2008-02-16 08:16:42 UTC 
(rev 6318)
@@ -39,7 +39,7 @@
 /**
  * How many search results are there?
  */
-#define TOTAL 100
+#define TOTAL 40
 
 static struct GNUNET_GE_Context *ectx;
 
@@ -54,7 +54,8 @@
 static int
 testTerminate (void *unused)
 {
-  return found == TOTAL ? GNUNET_SYSERR : GNUNET_OK;
+  /* wait for us to find 90% */
+  return (found > (TOTAL*90)/100) ? GNUNET_SYSERR : GNUNET_OK;
 }
 
 static char *
@@ -101,12 +102,15 @@
       ret = GNUNET_ECRS_publish_under_keyword (ectx, cfg, key, 0, 0, 
GNUNET_get_time () + 100 * GNUNET_CRON_MINUTES,    /* expire */
                                                uri, meta);
       GNUNET_ECRS_meta_data_destroy (meta);
+      GNUNET_free (name);
+      if (ret == GNUNET_OK) 
+       return uri;
       GNUNET_ECRS_uri_destroy (uri);
-      GNUNET_free (name);
-      return (ret == GNUNET_OK) ? key : NULL;
+      return NULL;
     }
   else
     {
+      GNUNET_ECRS_uri_destroy (uri);
       GNUNET_free (name);
       return NULL;
     }
@@ -126,6 +130,8 @@
        {
          uris[i] = NULL;
          found++;
+         fprintf(stderr,
+                 ".");
          return GNUNET_OK;
        }
     }
@@ -182,14 +188,14 @@
         }
     }
   key = GNUNET_ECRS_keyword_strings_to_uri (keywords);
-  printf ("Uploading...\n");
+  fprintf (stderr, "Uploading...");
   for (i=0;i<TOTAL;i++)    
     {
       uris[i] = uploadFile (i+1);
+      CHECK(uris[i] != NULL);
       fprintf(stderr, ".");
     }
-  fprintf(stderr, "\n");
-
+  fprintf (stderr, "\nSearching...");
   GNUNET_snprintf (buf, 128, "localhost:%u", 2077 + PEER_COUNT * 10);
   GNUNET_GC_set_configuration_value_string (cfg, ectx, "NETWORK", "HOST",
                                             buf);
@@ -197,8 +203,10 @@
   ret = GNUNET_ECRS_search (ectx,
                             cfg,
                             key, 1, &searchCB, NULL, &testTerminate, NULL);
+  fprintf(stderr,
+         "\n");
   CHECK (ret == GNUNET_OK);
-  CHECK (found == TOTAL);
+  CHECK (found > (TOTAL*90)/100);
 FAILURE:
 #if START_PEERS
   GNUNET_TESTING_stop_daemons (peers);

Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2008-02-16 04:18:53 UTC (rev 6317)
+++ GNUnet/todo 2008-02-16 08:16:42 UTC (rev 6318)
@@ -7,9 +7,8 @@
 - tune GAP query planning code [RC]
 
 TESTING:
-- test that modified datastores return diverse subsets of large response sets
 - test new hostlist application
-- test GAP migration code
+- test GAP migration code (seems to be using far too much CPU!)
 - test GAP code in general (can we reproduce the pid-table assertion crash?)
 - test new gnunet-auto-share  
 





reply via email to

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