gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r6014 - in GNUnet/src: applications/datastore applications/


From: gnunet
Subject: [GNUnet-SVN] r6014 - in GNUnet/src: applications/datastore applications/dht/module applications/dht/tools applications/fs/fsui applications/fs/module util/network_client
Date: Sat, 22 Dec 2007 11:43:10 -0700 (MST)

Author: grothoff
Date: 2007-12-22 11:43:09 -0700 (Sat, 22 Dec 2007)
New Revision: 6014

Modified:
   GNUnet/src/applications/datastore/datastore.c
   GNUnet/src/applications/dht/module/cs.c
   GNUnet/src/applications/dht/module/routing.c
   GNUnet/src/applications/dht/tools/dhttest2.c
   GNUnet/src/applications/fs/fsui/serializetest2.c
   GNUnet/src/applications/fs/fsui/serializetest3.c
   GNUnet/src/applications/fs/fsui/serializetest4.c
   GNUnet/src/applications/fs/module/fs.c
   GNUnet/src/applications/fs/module/migration.c
   GNUnet/src/applications/fs/module/ondemand.c
   GNUnet/src/util/network_client/tcpiotest.c
Log:
heikki patch for better success rates

Modified: GNUnet/src/applications/datastore/datastore.c
===================================================================
--- GNUnet/src/applications/datastore/datastore.c       2007-12-22 18:09:23 UTC 
(rev 6013)
+++ GNUnet/src/applications/datastore/datastore.c       2007-12-22 18:43:09 UTC 
(rev 6014)
@@ -292,11 +292,9 @@
   cls.exists = GNUNET_NO;
   cls.value = value;
   sq->get (key, ntohl (value->type), &checkExists, &cls);
-  if ( (! cls.exists) &&
-       (ntohl (value->type) == GNUNET_ECRS_BLOCKTYPE_DATA) )
+  if ((!cls.exists) && (ntohl (value->type) == GNUNET_ECRS_BLOCKTYPE_DATA))
     sq->get (key, GNUNET_ECRS_BLOCKTYPE_ONDEMAND, &checkExists, &cls);
-  if ( (! cls.exists) &&
-       (ntohl (value->type) == GNUNET_ECRS_BLOCKTYPE_DATA) )
+  if ((!cls.exists) && (ntohl (value->type) == GNUNET_ECRS_BLOCKTYPE_DATA))
     sq->get (key, GNUNET_ECRS_BLOCKTYPE_ONDEMAND_OLD, &checkExists, &cls);
   if (cls.exists)
     {

Modified: GNUnet/src/applications/dht/module/cs.c
===================================================================
--- GNUnet/src/applications/dht/module/cs.c     2007-12-22 18:09:23 UTC (rev 
6013)
+++ GNUnet/src/applications/dht/module/cs.c     2007-12-22 18:43:09 UTC (rev 
6014)
@@ -47,7 +47,7 @@
 
 /**
  * Type of the linked list that is used by CS to
- * keep track of clients and their pending GET 
+ * keep track of clients and their pending GET
  * requests.
  */
 struct DHT_CLIENT_GET_RECORD

Modified: GNUnet/src/applications/dht/module/routing.c
===================================================================
--- GNUnet/src/applications/dht/module/routing.c        2007-12-22 18:09:23 UTC 
(rev 6013)
+++ GNUnet/src/applications/dht/module/routing.c        2007-12-22 18:43:09 UTC 
(rev 6014)
@@ -215,7 +215,7 @@
 
 
 /**
- * To how many peers should we (on average) 
+ * To how many peers should we (on average)
  * forward the request to obtain the desired
  * target_replication count (on average).
  */
@@ -284,7 +284,7 @@
       result->header.type = htons (GNUNET_P2P_PROTO_DHT_RESULT);
       result->type = htonl (type);
       result->hop_count = htonl (0);
-      result->network_size = htonl (GNUNET_DHT_estimate_network_diameter());
+      result->network_size = htonl (GNUNET_DHT_estimate_network_diameter ());
       result->key = *key;
       memcpy (&result[1], data, size);
     }
@@ -537,7 +537,9 @@
   hop_count = ntohl (get->hop_count);
   target_value = get_forward_count (hop_count, GET_TRIES);
   aget.hop_count = htonl (1 + hop_count);
-  aget.network_size = htonl(ntohl(get->network_size) + 
GNUNET_DHT_estimate_network_diameter());
+  aget.network_size =
+    htonl (ntohl (get->network_size) +
+           GNUNET_DHT_estimate_network_diameter ());
   if (target_value > GET_TRIES)
     target_value = GET_TRIES;
   for (i = 0; i < target_value; i++)
@@ -606,7 +608,9 @@
   aput = GNUNET_malloc (ntohs (msg->size));
   memcpy (aput, put, ntohs (msg->size));
   aput->hop_count = htons (hop_count + 1);
-  aput->network_size = htonl(ntohl(put->network_size) + 
GNUNET_DHT_estimate_network_diameter());
+  aput->network_size =
+    htonl (ntohl (put->network_size) +
+           GNUNET_DHT_estimate_network_diameter ());
   if (target_value > PUT_TRIES)
     target_value = PUT_TRIES;
   j = 0;
@@ -724,7 +728,7 @@
   get.header.type = htons (GNUNET_P2P_PROTO_DHT_GET);
   get.type = htonl (type);
   get.hop_count = htonl (0);
-  get.network_size = htonl (GNUNET_DHT_estimate_network_diameter());
+  get.network_size = htonl (GNUNET_DHT_estimate_network_diameter ());
   get.key = *key;
 #if DEBUG_ROUTING
   GNUNET_hash_to_enc (&get.key, &enc);
@@ -812,7 +816,7 @@
   put->key = *key;
   put->type = htonl (type);
   put->hop_count = htonl (0);
-  put->network_size = htonl (GNUNET_DHT_estimate_network_diameter());
+  put->network_size = htonl (GNUNET_DHT_estimate_network_diameter ());
   memcpy (&put[1], data, size);
   handlePut (NULL, &put->header);
   GNUNET_free (put);

Modified: GNUnet/src/applications/dht/tools/dhttest2.c
===================================================================
--- GNUnet/src/applications/dht/tools/dhttest2.c        2007-12-22 18:09:23 UTC 
(rev 6013)
+++ GNUnet/src/applications/dht/tools/dhttest2.c        2007-12-22 18:43:09 UTC 
(rev 6014)
@@ -96,7 +96,7 @@
 
   /* wait for DHT's to find each other! */
   sock = GNUNET_client_connection_create (NULL, cfg);
-  left = 30;                    /* how many iterations should we wait? */
+  left = 60;                    /* how many iterations should we wait? */
   while (GNUNET_OK ==
          GNUNET_STATS_get_statistics (NULL, sock, &waitForConnect, NULL))
     {
@@ -124,7 +124,7 @@
   /* verify that peer2 also sees the other DHT! */
   ok = 0;
   sock = GNUNET_client_connection_create (NULL, cfg);
-  left = 30;                    /* how many iterations should we wait? */
+  left = 60;                    /* how many iterations should we wait? */
   while (GNUNET_OK ==
          GNUNET_STATS_get_statistics (NULL, sock, &waitForConnect, NULL))
     {
@@ -166,7 +166,7 @@
   CHECK (1 == GNUNET_DHT_get (cfg,
                               ectx,
                               GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
-                              &key, 2 * GNUNET_CRON_SECONDS, NULL, NULL));
+                              &key, 10 * GNUNET_CRON_SECONDS, NULL, NULL));
   /* switch to peer2 */
   GNUNET_GC_set_configuration_value_string (cfg,
                                             ectx,
@@ -186,7 +186,7 @@
   CHECK (1 == GNUNET_DHT_get (cfg,
                               ectx,
                               GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
-                              &key, 2 * GNUNET_CRON_SECONDS, NULL, NULL));
+                              &key, 10 * GNUNET_CRON_SECONDS, NULL, NULL));
   GNUNET_hash ("key2", 4, &key);
   fprintf (stderr, "Peer2 gets key2");
   left = 10;
@@ -196,7 +196,7 @@
       if (1 == GNUNET_DHT_get (cfg,
                                ectx,
                                GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
-                               &key, 10 * GNUNET_CRON_SECONDS, NULL, NULL))
+                               &key, 15 * GNUNET_CRON_SECONDS, NULL, NULL))
         break;
       left--;
     }
@@ -217,7 +217,7 @@
       if (1 == GNUNET_DHT_get (cfg,
                                ectx,
                                GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
-                               &key, 10 * GNUNET_CRON_SECONDS, NULL, NULL))
+                               &key, 15 * GNUNET_CRON_SECONDS, NULL, NULL))
         break;
       left--;
     }

Modified: GNUnet/src/applications/fs/fsui/serializetest2.c
===================================================================
--- GNUnet/src/applications/fs/fsui/serializetest2.c    2007-12-22 18:09:23 UTC 
(rev 6013)
+++ GNUnet/src/applications/fs/fsui/serializetest2.c    2007-12-22 18:43:09 UTC 
(rev 6014)
@@ -31,7 +31,7 @@
 
 #define DEBUG_VERBOSE GNUNET_NO
 
-#define UPLOAD_PREFIX "/tmp/gnunet-fsui-searializetest2"
+#define UPLOAD_PREFIX "/tmp/gnunet-fsui-serializetest2"
 
 #define CHECK(a) if (!(a)) { ok = GNUNET_NO; GNUNET_GE_BREAK(ectx, 0); goto 
FAILURE; }
 

Modified: GNUnet/src/applications/fs/fsui/serializetest3.c
===================================================================
--- GNUnet/src/applications/fs/fsui/serializetest3.c    2007-12-22 18:09:23 UTC 
(rev 6013)
+++ GNUnet/src/applications/fs/fsui/serializetest3.c    2007-12-22 18:43:09 UTC 
(rev 6014)
@@ -30,7 +30,7 @@
 
 #define DEBUG_VERBOSE GNUNET_NO
 
-#define UPLOAD_PREFIX "/tmp/gnunet-fsui-searializetest3"
+#define UPLOAD_PREFIX "/tmp/gnunet-fsui-serializetest3"
 
 #define CHECK(a) if (!(a)) { ok = GNUNET_NO; GNUNET_GE_BREAK(ectx, 0); goto 
FAILURE; }
 

Modified: GNUnet/src/applications/fs/fsui/serializetest4.c
===================================================================
--- GNUnet/src/applications/fs/fsui/serializetest4.c    2007-12-22 18:09:23 UTC 
(rev 6013)
+++ GNUnet/src/applications/fs/fsui/serializetest4.c    2007-12-22 18:43:09 UTC 
(rev 6014)
@@ -31,7 +31,7 @@
 
 #define DEBUG_VERBOSE GNUNET_NO
 
-#define UPLOAD_PREFIX "/tmp/gnunet-fsui-searializetest4"
+#define UPLOAD_PREFIX "/tmp/gnunet-fsui-serializetest4"
 
 #define CHECK(a) if (!(a)) { ok = GNUNET_NO; GNUNET_GE_BREAK(ectx, 0); goto 
FAILURE; }
 

Modified: GNUnet/src/applications/fs/module/fs.c
===================================================================
--- GNUnet/src/applications/fs/module/fs.c      2007-12-22 18:09:23 UTC (rev 
6013)
+++ GNUnet/src/applications/fs/module/fs.c      2007-12-22 18:43:09 UTC (rev 
6014)
@@ -803,8 +803,8 @@
   GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
                  "Converting reply for query `%s' for gap.\n", &enc);
 #endif
-  if ( (ntohl (invalue->type) == GNUNET_ECRS_BLOCKTYPE_ONDEMAND) ||
-       (ntohl (invalue->type) == GNUNET_ECRS_BLOCKTYPE_ONDEMAND_OLD) )
+  if ((ntohl (invalue->type) == GNUNET_ECRS_BLOCKTYPE_ONDEMAND) ||
+      (ntohl (invalue->type) == GNUNET_ECRS_BLOCKTYPE_ONDEMAND_OLD))
     {
       if (GNUNET_OK != ONDEMAND_getIndexed (datastore, invalue, key, &xvalue))
         return GNUNET_SYSERR;
@@ -948,8 +948,7 @@
     ret = datastore->get (&keys[0],
                           GNUNET_ECRS_BLOCKTYPE_ONDEMAND,
                           &gapGetConverter, &myClosure);
-  if ( (myClosure.count == 0) &&
-       (type == GNUNET_ECRS_BLOCKTYPE_DATA) )
+  if ((myClosure.count == 0) && (type == GNUNET_ECRS_BLOCKTYPE_DATA))
     ret = datastore->get (&keys[0],
                           GNUNET_ECRS_BLOCKTYPE_ONDEMAND_OLD,
                           &gapGetConverter, &myClosure);

Modified: GNUnet/src/applications/fs/module/migration.c
===================================================================
--- GNUnet/src/applications/fs/module/migration.c       2007-12-22 18:09:23 UTC 
(rev 6013)
+++ GNUnet/src/applications/fs/module/migration.c       2007-12-22 18:43:09 UTC 
(rev 6014)
@@ -266,8 +266,8 @@
                  "Migration: random lookup in datastore returned type %d.\n",
                  ntohl (value->type));
 #endif
-  if ( (ntohl (value->type) == GNUNET_ECRS_BLOCKTYPE_ONDEMAND) ||
-       (ntohl (value->type) == GNUNET_ECRS_BLOCKTYPE_ONDEMAND_OLD) )
+  if ((ntohl (value->type) == GNUNET_ECRS_BLOCKTYPE_ONDEMAND) ||
+      (ntohl (value->type) == GNUNET_ECRS_BLOCKTYPE_ONDEMAND_OLD))
     {
       if (ONDEMAND_getIndexed (datastore,
                                value, &content[entry].key, &enc) != GNUNET_OK)

Modified: GNUnet/src/applications/fs/module/ondemand.c
===================================================================
--- GNUnet/src/applications/fs/module/ondemand.c        2007-12-22 18:09:23 UTC 
(rev 6013)
+++ GNUnet/src/applications/fs/module/ondemand.c        2007-12-22 18:43:09 UTC 
(rev 6014)
@@ -48,8 +48,8 @@
 typedef struct
 {
   /**
-   * 
-   */ 
+   *
+   */
   GNUNET_DatastoreValue header;
 
   unsigned int type;
@@ -82,8 +82,8 @@
 typedef struct
 {
   /**
-   * 
-   */ 
+   *
+   */
   GNUNET_DatastoreValue header;
 
   unsigned int type;
@@ -371,30 +371,30 @@
   DBlock *db;
 
 #if MIG72
-  const OnDemandBlock72 * odb_old;
+  const OnDemandBlock72 *odb_old;
   OnDemandBlock odb_stack;
   if (ntohl (dbv->size) != sizeof (OnDemandBlock))
     {
-      if (ntohl(dbv->size) != sizeof (OnDemandBlock72))
-       {
-         GNUNET_GE_BREAK (ectx, 0);
-         return GNUNET_SYSERR;
-       }
+      if (ntohl (dbv->size) != sizeof (OnDemandBlock72))
+        {
+          GNUNET_GE_BREAK (ectx, 0);
+          return GNUNET_SYSERR;
+        }
       else
-       {
-         odb_old = (OnDemandBlock72*) dbv;
-         odb_stack.header = odb_old->header;
-         odb_stack.type = odb_old->type;
-         odb_stack.fileOffset = odb_old->fileOffset;
-         odb_stack.blockSize = odb_old->blockSize;
-         odb_stack.fileId = odb_old->fileId;
-         odb = &odb_stack;
-       }
+        {
+          odb_old = (OnDemandBlock72 *) dbv;
+          odb_stack.header = odb_old->header;
+          odb_stack.type = odb_old->type;
+          odb_stack.fileOffset = odb_old->fileOffset;
+          odb_stack.blockSize = odb_old->blockSize;
+          odb_stack.fileId = odb_old->fileId;
+          odb = &odb_stack;
+        }
     }
   else
     {
       odb = (const OnDemandBlock *) dbv;
-    }  
+    }
 #else
   if (ntohl (dbv->size) != sizeof (OnDemandBlock))
     {
@@ -402,7 +402,7 @@
       return GNUNET_SYSERR;
     }
   odb = (const OnDemandBlock *) dbv;
-#endif  
+#endif
   fn = getOnDemandFile (&odb->fileId);
   if ((GNUNET_YES != GNUNET_disk_file_test (ectx,
                                             fn)) ||
@@ -598,19 +598,18 @@
   GNUNET_DatastoreValue *comp = closure;
 
 #if MIG72
-  const OnDemandBlock72 * odb1 = (const OnDemandBlock72*) &value[1];
-  const OnDemandBlock72 * odb2 = (const OnDemandBlock72*) &comp[1];
-  if ( (comp->size != value->size) ||
-       ( ( (ntohl(value->size) - sizeof(GNUNET_DatastoreValue) != 
sizeof(OnDemandBlock72)) ||
-          (odb1->type != odb2->type) ||
-          (odb1->fileOffset != odb2->fileOffset) ||
-          (odb1->blockSize != odb2->blockSize) ||
-          (0 != memcmp(&odb1->fileId,
-                       &odb2->fileId,
-                       sizeof(GNUNET_HashCode)) ) ) &&
-        (0 != memcmp (&value[1],
-                      &comp[1],
-                      ntohl (value->size) - sizeof (GNUNET_DatastoreValue)))) 
)    
+  const OnDemandBlock72 *odb1 = (const OnDemandBlock72 *) &value[1];
+  const OnDemandBlock72 *odb2 = (const OnDemandBlock72 *) &comp[1];
+  if ((comp->size != value->size) ||
+      (((ntohl (value->size) - sizeof (GNUNET_DatastoreValue) !=
+         sizeof (OnDemandBlock72)) || (odb1->type != odb2->type)
+        || (odb1->fileOffset != odb2->fileOffset)
+        || (odb1->blockSize != odb2->blockSize)
+        || (0 !=
+            memcmp (&odb1->fileId, &odb2->fileId, sizeof (GNUNET_HashCode))))
+       && (0 !=
+           memcmp (&value[1], &comp[1],
+                   ntohl (value->size) - sizeof (GNUNET_DatastoreValue)))))
 #else
   if ((comp->size != value->size) ||
       (0 != memcmp (&value[1],
@@ -718,24 +717,22 @@
         ret = GNUNET_SYSERR;
 #if MIG72
       if (ret == GNUNET_SYSERR)
-       {
-         memset(&odb_old,
-                0,
-                sizeof(OnDemandBlock72));
-         odb_old.header.size = htonl (sizeof (OnDemandBlock));
-         odb_old.header.type = htonl (GNUNET_ECRS_BLOCKTYPE_ONDEMAND);
-         odb_old.header.prio = 0;
-         odb_old.header.anonymityLevel = 0;
-         odb_old.header.expirationTime = 0;
-         odb_old.type = htonl (GNUNET_ECRS_BLOCKTYPE_ONDEMAND);
-         odb_old.fileOffset = GNUNET_htonll (pos);
-         odb_old.blockSize = htonl (delta);
-         odb_old.fileId = *fileId;
-         if (GNUNET_SYSERR == datastore->get (&key, 
GNUNET_ECRS_BLOCKTYPE_ONDEMAND_OLD, &completeValue, &odb_old.header))  /* 
aborted == found! */
-           ret = datastore->del (&key, &odb_old.header);
-         else                      /* not found */
-           ret = GNUNET_SYSERR;
-       }
+        {
+          memset (&odb_old, 0, sizeof (OnDemandBlock72));
+          odb_old.header.size = htonl (sizeof (OnDemandBlock));
+          odb_old.header.type = htonl (GNUNET_ECRS_BLOCKTYPE_ONDEMAND);
+          odb_old.header.prio = 0;
+          odb_old.header.anonymityLevel = 0;
+          odb_old.header.expirationTime = 0;
+          odb_old.type = htonl (GNUNET_ECRS_BLOCKTYPE_ONDEMAND);
+          odb_old.fileOffset = GNUNET_htonll (pos);
+          odb_old.blockSize = htonl (delta);
+          odb_old.fileId = *fileId;
+          if (GNUNET_SYSERR == datastore->get (&key, 
GNUNET_ECRS_BLOCKTYPE_ONDEMAND_OLD, &completeValue, &odb_old.header))      /* 
aborted == found! */
+            ret = datastore->del (&key, &odb_old.header);
+          else                  /* not found */
+            ret = GNUNET_SYSERR;
+        }
 #endif
       if (ret == GNUNET_SYSERR)
         {

Modified: GNUnet/src/util/network_client/tcpiotest.c
===================================================================
--- GNUnet/src/util/network_client/tcpiotest.c  2007-12-22 18:09:23 UTC (rev 
6013)
+++ GNUnet/src/util/network_client/tcpiotest.c  2007-12-22 18:43:09 UTC (rev 
6014)
@@ -215,6 +215,7 @@
     }
   GNUNET_client_connection_destroy (clientSocket);
   CLOSE (serverSocket);
+  fprintf (stderr, "\n");
   if (ret > 0)
     fprintf (stderr, "Error %d\n", ret);
   GNUNET_GC_free (cfg);





reply via email to

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